int and larger values are type long. By adding a suffix, we can force the type of a literal integer constant to be type long or unsigned or unsigned long. We specify that a constant is a long by immediately following the value with either L or l (the letter “ell” in either uppercase or lowercase).
根据语法, 八进制或十六进制的整数字面常量有可能是unsigned 类型(unsigned int 或unsignedlong),而十进制的整数字面常量只能是int 或long 类型。不过代码中还是直接以后缀标明类型为佳。
When specifying a long, use the uppercase L: the lowercase letter l is too easily mistaken for the digit 1.
In a similar manner, we can specify unsigned by following the literal with either U or u. We can obtain an unsigned long literal constant by following the value by both L and U. The suffix must appear with no intervening space:
- 128u 1024UL
- 1L 8Lu
There are no literals of type short.
We can use either common decimal notation or scientific notation to write floatingpoint literal constants. Using scientific notation, the exponent is indicated either by E or e. By default, floating-point literals are type double. We indicate single
precision by following the value with either F or f. Similarly, we specify extended precision by following the value with either L or l (again, use of the lowercase l is discouraged). Each pair of literals below denote the same underlying value:
3.14159F .001f 12.345L 0.
3.14159E0f 1E-3F 1.2345E1L 0e0
Printable character literals are written by enclosing the character within single quotation marks: