The (1) decimal integer constant consists of a series of consecutive numbers from 0 to 9. Such as: 0,120,365,-12, etc.
(2) Octal integer constants begin with the number 0, where the number is 0~7. Such as: 0 1 12 (decimal 74), 0 123 (decimal 83), 077 (decimal 63), etc.
(3) Hexadecimal integer constants start with 0X (number 0 and letter x) or 0x, where the number can be a number from 0 to 9, a to f or a to f or English letters. Such as 0x 1 1 (decimal 17), 0xa5 (decimal 165), 0X5a (decimal 90), etc.
Integer constants are divided into short integer, basic integer, long integer and unsigned integer.
Extended data
Representation of integer constants:
1)? Decimal integer constant: Decimal integer constant has no prefix. Its number is 0 ~ 9.
The following numbers are legal decimal integer constants: 237, -568, 65535,1627; In the program, all kinds of decimal numbers are distinguished by prefixes. Therefore, when writing constants, don't get the prefix wrong, which will lead to incorrect results.
2)? Octal integer constant: Octal integer constant must start with 0, that is, 0 is the prefix of octal number. Digital value is 0 ~ 7. Octal numbers are usually unsigned numbers. The following numbers are legal octal numbers: 0 15 (decimal 13), 010 (decimal 65), 0 17777 (decimal 65535);
3)? Hexadecimal integer constant: Hexadecimal integer constant is prefixed with 0X or 0x. Its numerical value is 0~9, A~F or a ~ f, and the following figures are legal hexadecimal integer constants:? 0X2A (decimal 42), 0XA0? (decimal 160), 0XFFFF? (decimal 65535);
4)? Integer constant suffix: On the machine with the word length of 16 bits, the length of the basic integer is also 16 bits, so the range of the number represented is also limited. Decimal unsigned integer constants range from 0 to 65535, and signed numbers range from -32768 to +32767.
The range of octal unsigned number is 0 ~ 0 177777. The expression range of hexadecimal unsigned number is 0x0×0~0xFFFF or 0×0~0xFFFF. If the number used exceeds the above range, it must be expressed as a long integer. Long integers are denoted by the suffix "l" or "l".