共用方式為


Literals (C++)

Invariant program elements are called "literals" or "constants." The terms "literal" and "constant" are used interchangeably here. Literals fall into four major categories: integer, character, floating-point, and string literals.

A literal may be any of the following:

integer-constant
character-constant
floating-constant
string-literal

Examples

157 // integer constant
0xFE // integer constant
'c' // character constant
0.2 // floating constant
0.2E-01 // floating constant
"dog" // string literal

For more examples, see the following sections, referenced above.

See Also

Reference

Lexical Conventions