Possible Duplicate:
Can I use a binary literal in C or C++?
I am learning C and i recently found out that we can represent integers in different ways, like that:
(Assuming i
has "human-readable" value of 512.) Here are the representations:
Decimal:
int i = 512;
Octal:
int i = 01000;
Hexadecimal:
int i = 0x200;
In base 2 (or binary representation) 512 is 1000000000. How to write this in C?
Something like int i = 1000000000b
? This is funny but unfortunately no C compiler accepts that value.