[c] Writing binary number system in C code

As we use 0x prefix for hexadecimal numbers, and 0 for octal ones, is there anything that can be done for binary numbers?

I tried the b suffix, but the GCC didn't allow it.

Error: invalid suffix "b" on integer constant

Is it possible?

This question is related to c

The answer is


Use BOOST_BINARY (Yes, you can use it in C).

#include <boost/utility/binary.hpp>
...
int bin = BOOST_BINARY(110101);

This macro is expanded to an octal literal during preprocessing.


Prefix you literal with 0b like in

int i = 0b11111111;

See here.