Interview Questions

Can I use base-2 constants (something like 0b101010)? Is there a printf format for binary?

C Interview Questions and Answers


(Continued from previous question...)

Can I use base-2 constants (something like 0b101010)? Is there a printf format for binary?

No, on both counts, although there are various preprocessor tricks you can try. You can convert base-2 string representations to integers with strtol. If you need to print numbers out in base 2, .

(Continued on next question...)

Other Interview Questions