Your Ad Here

Tuesday, August 5, 2008

Hexadecimal and Octal Constants

It is sometimes easier to use a number system based on 8 or 16 rather than 10. The number system
based on 8 is called octal and uses the digits 0 through 7. In octal, the number 10 is the same as 8 in
decimal. 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 10 is 16 in decimal. Because these two number systems are used frequently, C
allows you to 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.

No comments: