常量摘要

constant
floating-point-constant

integer-constant

enumeration-constant

character-constant

floating-point-constant
fractional-constant exponent-part optfloating-suffix opt

digit-sequence exponent-part floating-suffix opt

fractional-constant
digit-sequence opt.digit-sequence

digit-sequence .

exponent-part
e sign optdigit-sequence

E sign optdigit-sequence

sign: one of
+ -

digit-sequence
digit

digit-sequence digit

floating-suffix: one of
f l F L

integer-constant:
decimal-constant integer-suffix opt

octal-constant integer-suffix opt

hexadecimal-constant integer-suffix opt

decimal-constant:
nonzero-digit

decimal-constant digit

octal-constant:
0

octal-constant octal-digit

hexadecimal-constant:
0x hexadecimal-digit

0X hexadecimal-digit

hexadecimal-constant hexadecimal-digit

nonzero-digit: one of
1 2 3 4 5 6 7 8 9

octal-digit: one of
0 1 2 3 4 5 6 7

hexadecimal-digit: one of
0 1 2 3 4 5 6 7 8 9

a b c d e f

A B C D E F

unsigned-suffix: one of
u U

long-suffix: one of
l L

character-constant
' c-char-sequence

'L' c-char-sequence '

integer-suffix:
unsigned-suffix long-suffix opt

long-suffix unsigned-suffix opt

c-char-sequence:
c-char

c-char-sequence c-char

c-char:
除单引号 (')、反斜杠 (\) 或换行符 escape-sequence 以外的所有源字符集成员

escape-sequence:
simple-escape-sequence

octal-escape-sequence

hexadecimal-escape-sequence

simple-escape-sequence: one of
\a \b \f \n \r \t \v

\' \" \\ \?

octal-escape-sequence:
\ octal-digit

\ octal-digit octal-digit

\ octal-digit octal-digit octal-digit

hexadecimal-escape-sequence
\x hexadecimal-digit

hexadecimal-escape-sequence hexadecimal-digit

另请参阅

词法语法