# C 整数常量C Integer Constants

## 语法Syntax

integer-constant:integer-constant:
decimal-constant integer-suffixopt    decimal-constant integer-suffixopt
octal-constant integer-suffixopt    octal-constant integer-suffixopt

decimal-constant:decimal-constant:
nonzero-digit    nonzero-digit
decimal-constant digit    decimal-constant digit

octal-constant:octal-constant:
0    0
octal-constant octal-digit    octal-constant octal-digit

0x 0X    0x 0X

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

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

0 1 2 3 4 5 6 7 8 9    0 1 2 3 4 5 6 7 8 9
a b c d e f    a b c d e f
A B C D E F    A B C D E F

integer-suffix:integer-suffix:
unsigned-suffix long-suffixopt    unsigned-suffix long-suffixopt
unsigned-suffix long-long-suffix    unsigned-suffix long-long-suffix
unsigned-suffix 64-bit-integer-suffix    unsigned-suffix 64-bit-integer-suffix
long-suffix unsigned-suffixopt    long-suffix unsigned-suffixopt
long-long-suffix unsigned-suffixopt    long-long-suffix unsigned-suffixopt
64-bit-integer-suffix    64-bit-integer-suffix

unsigned-suffix: one ofunsigned-suffix: one of
u U    u U

long-suffix: one oflong-suffix: one of
l L    l L

long-long-suffix: one oflong-long-suffix: one of
ll LL    ll LL

64-bit-integer-suffix: one of64-bit-integer-suffix: one of
i64 I64    i64 I64

i64 和 I64 后缀为 Microsoft 专用。The i64 and I64 suffixes are Microsoft-specific.

``````28
0x1C   /* = Hexadecimal representation for decimal 28 */
034    /* = Octal representation for decimal 28 */
``````

``````    /* Decimal Constants */
int                 dec_int    = 28;
unsigned            dec_uint   = 4000000024u;
long                dec_long   = 2000000022l;
unsigned long       dec_ulong  = 4000000000ul;
long long           dec_llong  = 9000000000LL;
unsigned long long  dec_ullong = 900000000001ull;
__int64             dec_i64    = 9000000000002I64;
unsigned __int64    dec_ui64   = 90000000000004ui64;

/* Octal Constants */
int                 oct_int    = 024;
unsigned            oct_uint   = 04000000024u;
long                oct_long   = 02000000022l;
unsigned long       oct_ulong  = 04000000000UL;
long long           oct_llong  = 044000000000000ll;
unsigned long long  oct_ullong = 044400000000000001Ull;
__int64             oct_i64    = 04444000000000000002i64;
unsigned __int64    oct_ui64   = 04444000000000000004uI64;