Wednesday, May 9, 2012

Can I use a binary literal in C or C++?

http://stackoverflow.com/questions/2611764/can-i-use-a-binary-literal-in-c-or-c

If you are using GCC then you can use GCC extension for this:



int x = 0b00010000;http://gcc.gnu.org/onlinedocs/gcc/Binary-constants.html
Binary constants using the '0b' prefix
http://gcc.gnu.org/onlinedocs/gcc/Binary-constants.html

C operator precedence
http://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B#Operator_precedence

No comments:

Post a Comment