Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Enter binary instead of hex [duplicate]

Tags:

c

Possible Duplicate:
Can I use a binary literal in C or C++?

In C I can write

uint32_t a = 0x40022000;

using hex. Can I do something similar by entering binary digits?

like image 344
Randomblue Avatar asked May 02 '26 20:05

Randomblue


1 Answers

You can't do that with standard C, but some compilers such as gcc supports an extension that allows you to write something like

uint32_t a = 0b11010101110101;
like image 74
kennytm Avatar answered May 05 '26 10:05

kennytm



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!