Hello, I just want to code a binary data in C. I mean hera representation is "0x5F", the decimal representation is simply "156" but what is the decimal representation. I tried 0b010010101 but it doesn't work Many thanks Sébastien
C doesn't support binary numerical constants (see K&R). Perhaps a simple macro could help: #define BIN(b7,b6,b5,b4,b3,b2,b1,b0) ((b0)+((b1)<<1)+((b2)<<2)+((b3)<<3)+((b4)<<4)+((b5)<<5)+((b6)<<6)+((b7)<<7)) Then your constant would look like this: int i = BIN(1,0,0,1,0,1,0,1); Of course, you can extend the macro to suport a greater number of bits. Regards, Mike.