Integer literalssuggest change
Integer literals are used to provide integral values. Three numerical bases are supported, indicated by prefixes:
Base | Prefix | Example |
—— | —— | —— |
Decimal | None |
Note that this writing doesn’t include any sign, so integer literals are always positive. Something like
-1 is treated as an expression that has one integer literal (
1) that is negated with a
The type of a decimal integer literal is the first data type that can fit the value from
long. Since C99,
long long is also supported for very large literals.
The type of an octal or hexadecimal integer literal is the first data type that can fit the value from
unsigned long. Since C99,
long long and
unsigned long long are also supported for very large literals.
Using various suffixes, the default type of a literal can be changed.
Suffix | Explanation |
—— | —— |
long int |
ll (since C99) |
long long int |
The U and L/LL suffixes can be combined in any order and case. It is an error to duplicate suffixes (e.g. provide two
U suffixes) even if they have different cases.