Integer Constants
Four ways to write integer constants in C
-
42 ...signed decimal (0 ..9 )
-
0x2A ...unsigned hexadecimal (0 ..F )
-
052 ... unsigned octal (0 ..7 )
-
0b1010 ... unsigned binary (0 ..1 )
Variations
-
123U ... unsigned int value (typically 32 bits)
-
123LL ... long long int value (typically 64 bits)
-
123S ... short int value (typically 16 bits)
Invalid constants lie outside the range for their type, e.g.
-
4294967296 , -1U , 666666S , 078 0b234
|