The type of integer literals given in base 10 is the first type in the following list in which their value can fit:
int
long int
long long int
For octal and hexadecimal literals, unsigned types will be considered as well, in the following order:
int
unsigned int
long int
unsigned long int
long long int
unsigned long long int
You can specify a u
suffix to force unsigned
types, an l
suffix to force long
or long long
, or an ll
suffix to force long long
.
Reference: C99, 6.4.4.1p5