- Docs »
- C Programming »
- Binary (0b) and Hexadecimal (0x) Literals
- Edit on GitHub
Binary is a base-2 numbering system (digits are either 0 or 1), while hexadecimal is a base-16 numbering system (digits 0-F). Look online for descriptions of how these systems work.
In C, you can express integers using their binary or hexadecimal representations by prefixing them with 0b
or 0x
.
// These represent different numbersuint8_t binary = 0b01101011;uint8_t hex = 0xF7;