I need to work with a binary number.
I tried writing:
const x = 00010000;
But it didn\'t work.
I know that I can use an hex
The smallest unit you can work with is a byte (which is of char type). You can work with bits though by using bitwise operators.
As for integer literals, you can only work with decimal (base 10), octal (base 8) or hexadecimal (base 16) numbers. There are no binary (base 2) literals in C nor C++.
Octal numbers are prefixed with 0 and hexadecimal numbers are prefixed with 0x. Decimal numbers have no prefix.
In C++0x you'll be able to do what you want by the way via user defined literals.