Octal:
The number system based on 8 is called octal and uses the digits 0 through 7. In octal, the number 15 is the same as 13 in decimal.
Hexadecimal:
The base 16 number system is called hexadecimal and uses the digits 0 through 9 plus the letters A through F, which stand for 10, 11, 12, 13, 14, and 15, respectively. For example, the hexadecimal number A is 10 in decimal.
It is sometimes more easier to use a number system based on 8 or 16 rather than 10. Because these two number systems are used frequently, C allows usto specify integer constants in hexadecimal or octal instead of decimal. A hexadecimal constant must consist of a Ox followed by the constant in hexadecimal form. An octal constant begins with a 0.
Here are two examples:
int hex = 0x40; in Decimal 64
int oct = 040; in Decimal 32
Comments
Post a Comment
Give your valuable Comment...