Integer literals
print(255) // decimal literal (Int) print(255L) // decimal literal (Long) print(0000'00FF) // hexadecimal literal print(00'FF) // short hexadecimal literal print(F'F) // ultrashort (single-byte) hexadecimal literal print(377o) // octal literal print(1111'1111b) // binary literal print(255'000) // decimal literal print(1'00000000) // special hexadecimal literalOutput:
255 255 255 255 255 255 255 255000 4294967296
Note that digit separator
'is necessary for hexadecimal literals.
[Someone might want to put in code a credit card number (like 1234'5678'9012'3456, which is hexadecimal (but not decimal!) literal in 11l), but how frequently this is really needed in practice?]
Why
'instead of
_— there may be a valid identifier (e.g. the name of the enumerator
C0_FE).
Long-suffix (character
L)
If provided, the literal is of type
Long.