You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An "integer constant" is a decimal (base 10), octal (base 8), or hexadecimal (base 16) number that represents an integral value. Use integer constants to represent integer values that cannot be changed.
21
-
22
-
## Syntax
23
-
*integer-constant*:
24
-
*decimal-constant integer-suffix* opt
25
-
26
-
*octal-constant integer-suffix* opt
27
-
28
-
*hexadecimal-constant integer-suffix* opt
29
-
30
-
*decimal-constant*:
31
-
*nonzero-digit*
32
-
33
-
*decimal-constant digit*
34
-
35
-
*octal-constant*:
36
-
**0**
37
-
38
-
*octal-constant octal-digit*
39
-
40
-
*hexadecimal-constant*:
41
-
**0x***hexadecimal-digit*
42
-
43
-
**0X***hexadecimal-digit*
44
-
45
-
*hexadecimal-constant hexadecimal-digit*
46
-
47
-
*nonzero-digit*: one of
48
-
**1 2 3 4 5 6 7 8 9**
49
-
50
-
*octal-digit*: one of
51
-
**0 1 2 3 4 5 6 7**
52
-
53
-
*hexadecimal-digit*: one of
54
-
**0 1 2 3 4 5 6 7 8 9**
55
-
56
-
**a b c d e f**
57
-
58
-
**A B C D E F**
59
-
60
-
*integer-suffix*:
61
-
*unsigned-suffix long-suffix* opt
62
-
63
-
*long-suffix unsigned-suffix* opt
64
-
65
-
*unsigned-suffix*: one of
66
-
**u U**
67
-
68
-
*long-suffix*: one of
69
-
**l L**
70
-
71
-
*64-bit integer-suffix*:
72
-
**i64**
73
-
74
-
Integer constants are positive unless they are preceded by a minus sign (**-**). The minus sign is interpreted as the unary arithmetic negation operator. (See [Unary Arithmetic Operators](../c-language/unary-arithmetic-operators.md) for information about this operator.)
75
-
76
-
If an integer constant begins with **0x** or **0X**, it is hexadecimal. If it begins with the digit **0**, it is octal. Otherwise, it is assumed to be decimal.
77
-
78
-
The following lines are equivalent:
79
-
80
-
```
81
-
0x1C /* = Hexadecimal representation for decimal 28 */
82
-
034 /* = Octal representation for decimal 28 */
83
-
```
84
-
85
-
No white-space characters can separate the digits of an integer constant. These examples show valid decimal, octal, and hexadecimal constants.
86
-
87
-
```
88
-
/* Decimal Constants */
89
-
10
90
-
132
91
-
32179
92
-
93
-
/* Octal Constants */
94
-
012
95
-
0204
96
-
076663
97
-
98
-
/* Hexadecimal Constants */
99
-
0xa or 0xA
100
-
0x84
101
-
0x7dB3 or 0X7DB3
102
-
```
103
-
104
-
## See Also
105
-
[C Constants](../c-language/c-constants.md)
20
+
21
+
An "integer constant" is a decimal (base 10), octal (base 8), or hexadecimal (base 16) number that represents an integral value. Use integer constants to represent integer values that cannot be changed.
Integer constants are positive unless they are preceded by a minus sign (**-**). The minus sign is interpreted as the unary arithmetic negation operator. (See [Unary Arithmetic Operators](../c-language/unary-arithmetic-operators.md) for information about this operator.)
69
+
70
+
If an integer constant begins with **0x** or **0X**, it is hexadecimal. If it begins with the digit **0**, it is octal. Otherwise, it is assumed to be decimal.
71
+
72
+
The following lines are equivalent:
73
+
74
+
```C
75
+
0x1C/* = Hexadecimal representation for decimal 28 */
76
+
034/* = Octal representation for decimal 28 */
77
+
```
78
+
79
+
No white-space characters can separate the digits of an integer constant. These examples show valid decimal, octal, and hexadecimal constants.
0 commit comments