An integer can be specified using one of three formats.
A decimal integer constant is a stream of digits with non-leading zero, for example:
123 | valid | 
A123 | invalid (begins with non-digit) | 
0123 | invalid (begins with zero but is a valid octal) | 
An octal integer constant is a stream of digits with a leading
zero. The digits 8 and 9 have octal values 10
and 11 respectively. For example:
0456 | valid (= 302 decimal) | 
018 | valid (= 020 octal = 16 decimal) | 
456 | invalid (but is a valid decimal) | 
A456 | invalid (begins with non-digit) | 
An hexadecimal integer constant is a stream of hexadecimal
digits starting with 0x (zero followed by the character
x). Letters A to F have the hexadecimal values
10 to 15 respectively. Lowercase letters a to f
are equivalent to their corresponding uppercase letters, for instance:
0xAB | valid (= 171 decimal) | 
0x1f | valid (= 31 decimal) | 
AB | invalid (begins with an alphabet letter) | 
01f | invalid (missing x) |