1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
|
<h1 id="firstHeading" class="firstHeading">Punctuation</h1> <p>These are the punctuation symbols in C. The meaning of each symbol is detailed in the linked pages.</p>
<h3 id=".7B_.7D"> <code>{</code> <code>}</code>
</h3> <ul>
<li> In a <a href="struct" title="c/language/struct">struct</a> or <a href="union" title="c/language/union">union</a> definition, delimit the <span class="t-spar">struct-declaration-list</span>. </li>
<li> In an <a href="enum" title="c/language/enum">enum</a> definition, delimit the enumerator list. </li>
<li> Delimit a <a href="statements#Compound_statements" title="c/language/statements">compound statement</a>. The compound statement may be part of a <a href="function_definition" title="c/language/function definition">function definition</a>. </li>
<li> In <a href="initialization" title="c/language/initialization">initialization</a>, delimit the initializers. </li>
</ul> <h3 id=".5B_.5D"> <code>[</code> <code>]</code>
</h3> <ul>
<li> <a href="operator_member_access#Subscript" title="c/language/operator member access">Subscript operator</a>. </li>
<li> Part of <a href="declarations#Declarators" title="c/language/declarations">array declarator</a> in a <a href="declarations" title="c/language/declarations">declaration</a> or a <a href="type#Type_names" title="c/language/type">type-id</a>. </li>
<li> In <a href="initialization" title="c/language/initialization">initialization</a>, introduce a designator for an array element. <span class="t-mark-rev t-since-c99">(since C99)</span> </li>
<li> In an <a href="attributes" title="c/language/attributes">attribute specifier</a>, delimit the attributes. <span class="t-mark-rev t-since-c23">(since C23)</span> </li>
</ul> <h3 id=".23"> <code>#</code>
</h3> <ul>
<li> Introduce a <a href="../preprocessor" title="c/preprocessor">preprocessing directive</a>. </li>
<li> The <a href="../preprocessor/replace#.23_and_.23.23_operators" title="c/preprocessor/replace">preprocessing operator for stringification</a>. </li>
</ul> <h3 id=".23.23"> <code>##</code>
</h3> <ul><li> The <a href="../preprocessor/replace#.23_and_.23.23_operators" title="c/preprocessor/replace">preprocessing operator for token pasting</a>. </li></ul> <h3 id=".28_.29"> <code>(</code> <code>)</code>
</h3> <ul>
<li> In an expression, <a href="expressions#Primary_expressions" title="c/language/expressions">indicate grouping</a>. </li>
<li> <a href="operator_other#Function_call" title="c/language/operator other">Function call operator</a>. </li>
<li> In a <a href="sizeof" title="c/language/sizeof"><code>sizeof</code></a><span class="t-rev-inl t-since-c11"><span>, <a href="_alignof" title="c/language/ Alignof"><code>_Alignof</code></a></span><span><span class="t-mark-rev t-since-c11">(since C11)</span></span></span> <span class="t-rev-inl t-since-c23"><span>, <a href="typeof" title="c/language/typeof"><code>typeof</code></a> or <a href="https://en.cppreference.com/mwiki/index.php?title=c/language/typeof_unqual&action=edit&redlink=1" class="new" title="c/language/typeof unqual (page does not exist)"><code>typeof_unqual</code></a></span><span><span class="t-mark-rev t-since-c23">(since C23)</span></span></span> expression, delimit the operand. </li>
<li> In an <a href="cast" title="c/language/cast">explicit cast</a>, delimit the type-id. </li>
<li> In a <a href="compound_literal" title="c/language/compound literal">compound literal</a>, delimit the type-id. <span class="t-mark-rev t-since-c99">(since C99)</span> </li>
<li> In a <a href="declarations" title="c/language/declarations">declaration</a> or a <a href="type#Type_names" title="c/language/type">type-id</a>, indicate grouping. </li>
<li> In a <a href="function_declaration" title="c/language/function declaration">function declarator</a> (in a <a href="declarations" title="c/language/declarations">declaration</a> or a <a href="type#Type_names" title="c/language/type">type-id</a>), delimit the parameter list. </li>
<li> In an <a href="if" title="c/language/if"><code>if</code></a>, <a href="switch" title="c/language/switch"><code>switch</code></a>, <a href="while" title="c/language/while"><code>while</code></a>, <a href="do" title="c/language/do"><code>do-while</code></a>, or <a href="for" title="c/language/for"><code>for</code></a> statement, delimit the controlling clause. </li>
<li> In a <a href="../preprocessor/replace#Function-like_macros" title="c/preprocessor/replace">function-like macro definition</a>, delimit the macro parameters. </li>
<li> In a <a href="../preprocessor/replace#Function-like_macros" title="c/preprocessor/replace">function-like macro invocation</a>, delimit the macro arguments or prevent commas from being interpreted as argument separators. </li>
<li> Part of a <code>defined</code><span class="t-rev-inl t-since-c23"><span>, <code>__has_include</code>, <code>__has_embed</code> or <code>__has_c_attribute</code></span><span><span class="t-mark-rev t-since-c23">(since C23)</span></span></span> preprocessing operator. </li>
<li> Part of a <a href="generic" title="c/language/generic">generic selection expression</a>. <span class="t-mark-rev t-since-c11">(since C11)</span> </li>
<li> In an <a href="atomic" title="c/language/atomic"><code>_Atomic</code></a> type specifier, delimit the type-id. <span class="t-mark-rev t-since-c11">(since C11)</span> </li>
<li> In a <a href="_static_assert" title="c/language/ Static assert">static assertion declaration</a>, delimit the operands. <span class="t-mark-rev t-since-c11">(since C11)</span> </li>
<li> In an <a href="_alignas" title="c/language/ Alignas"><code>_Alignas</code></a> specifier, delimit the operand. <span class="t-mark-rev t-since-c11">(since C11)</span> </li>
<li> In an <a href="attributes" title="c/language/attributes">attribute</a>, delimit the attribute arguments. <span class="t-mark-rev t-since-c23">(since C23)</span> </li>
<li> In a bit-precise integer type name (_BitInt<span class="br0">(</span>N<span class="br0">)</span>), delimit the size. <span class="t-mark-rev t-since-c23">(since C23)</span> </li>
<li> Part of <a href="../preprocessor/replace" title="c/preprocessor/replace"><code>__VA_OPT__</code></a> replacement in a variadic macro definition. <span class="t-mark-rev t-since-c23">(since C23)</span> </li>
<li> In a preprocessor parameter used in <a href="../preprocessor/embed" title="c/preprocessor/embed"><code>#embed</code> directives</a> and <code>__has_embed</code> preprocessing expressions, delimit the preprocessor parameter clause. <span class="t-mark-rev t-since-c23">(since C23)</span> </li>
</ul> <h3 id=".3B"> <code>;</code>
</h3> <ul>
<li> Indicate the end of </li>
<ul>
<li> a <a href="statements" title="c/language/statements">statement</a> (including the init-statement of a for statement) </li>
<li> a <a href="declarations" title="c/language/declarations">declaration</a> or <span class="t-spar">struct-declaration-list</span> </li>
</ul>
<li> Separate the second and third clauses of a <a href="for" title="c/language/for">for statement</a>. </li>
</ul> <h3 id=":"> <code>:</code>
</h3> <ul>
<li> Part of <a href="operator_other#Conditional_operator" title="c/language/operator other">conditional operator</a>. </li>
<li> Part of <a href="statements#Labels" title="c/language/statements">label declaration</a>. </li>
<li> In a <a href="bit_field" title="c/language/bit field">bit-field member declaration</a>, introduce the width. </li>
<li> Introduce an <a href="enum" title="c/language/enum">enum base</a>, which specifies the underlying type of the enum. <span class="t-mark-rev t-since-c23">(since C23)</span> </li>
<li> In a <a href="generic" title="c/language/generic">generic association</a>, delimit the type-id or <code>default</code> and the selected expression. <span class="t-mark-rev t-since-c11">(since C11)</span> </li>
</ul> <h3 id="..."> <code>...</code>
</h3> <ul>
<li> In the <a href="function_declaration#Parameter_list" title="c/language/function declaration">parameter list</a> of a function declarator, signify a <a href="variadic" title="c/language/variadic">variadic function</a>. </li>
<li> In a <a href="../preprocessor/replace" title="c/preprocessor/replace">macro definition</a>, signify a variadic macro. <span class="t-mark-rev t-since-c99">(since C99)</span> </li>
</ul> <h3 id=".3F"> <code>?</code>
</h3> <ul><li> Part of <a href="operator_other#Conditional_operator" title="c/language/operator other">conditional operator</a>. </li></ul> <h3 id="::"> <code>::</code>
</h3> <ul>
<li> In an <a href="attributes" title="c/language/attributes">attribute</a>, indicate attribute scope. <span class="t-mark-rev t-since-c23">(since C23)</span> </li>
<li> In a preprocessor prefixed parameter (used by <a href="../preprocessor/embed" title="c/preprocessor/embed"><code>#embed</code></a> and <code>__has_embed</code>), indicate scope. <span class="t-mark-rev t-since-c23">(since C23)</span> </li>
</ul> <h3 id="."> <code>.</code>
</h3> <ul>
<li> <a href="operator_member_access#Member_access" title="c/language/operator member access">Member access operator</a>. </li>
<li> In <a href="initialization" title="c/language/initialization">initialization</a>, introduce a designator for a struct/union member. <span class="t-mark-rev t-since-c99">(since C99)</span> </li>
</ul> <h3 id="-.3E"> <code>-></code>
</h3> <ul><li> <a href="operator_member_access#Member_access_through_pointer" title="c/language/operator member access">Member access operator</a>. </li></ul> <h3 id=".7E"> <code>~</code>
</h3> <ul><li> <a href="operator_arithmetic#Bitwise_logic" title="c/language/operator arithmetic">Unary complement operator (a.k.a. bitwise not operator)</a>. </li></ul> <h3 id=".21"> <code>!</code>
</h3> <ul><li> <a href="operator_logical#Logical_NOT" title="c/language/operator logical">Logical not operator</a>. </li></ul> <h3 id=".2B"> <code>+</code>
</h3> <ul>
<li> <a href="operator_arithmetic#Unary_arithmetic" title="c/language/operator arithmetic">Unary plus operator</a>. </li>
<li> <a href="operator_arithmetic#Additive_operators" title="c/language/operator arithmetic">Binary plus operator</a>. </li>
</ul> <h3 id="-"> <code>-</code>
</h3> <ul>
<li> <a href="operator_arithmetic#Unary_arithmetic" title="c/language/operator arithmetic">Unary minus operator</a>. </li>
<li> <a href="operator_arithmetic#Additive_operators" title="c/language/operator arithmetic">Binary minus operator</a>. </li>
</ul> <h3 id=".2A"> <code>*</code>
</h3> <ul>
<li> <a href="operator_member_access#Dereference" title="c/language/operator member access">Indirection operator</a>. </li>
<li> <a href="operator_arithmetic#Multiplicative_operators" title="c/language/operator arithmetic">Multiplication operator</a>. </li>
<li> Pointer operator operator in a <a href="declarations#Declarators" title="c/language/declarations">declarator</a> or in a <a href="type#Type_names" title="c/language/type">type-id</a>. </li>
<li> Placeholder for the length of a variable-length array declarator in a <a href="function_declaration" title="c/language/function declaration">function declaration</a>. <span class="t-mark-rev t-since-c99">(since C99)</span> </li>
</ul> <h3 id=".2F"> <code>/</code>
</h3> <ul><li> <a href="operator_arithmetic#Multiplicative_operators" title="c/language/operator arithmetic">Division operator</a>. </li></ul> <h3 id=".25"> <code>%</code>
</h3> <ul><li> <a href="operator_arithmetic#Multiplicative_operators" title="c/language/operator arithmetic">Modulo operator</a>. </li></ul> <h3 id=".5E"> <code>^</code>
</h3> <ul><li> <a href="operator_arithmetic#Bitwise_logic" title="c/language/operator arithmetic">Bitwise xor operator</a>. </li></ul> <h3 id=".26"> <code>&</code>
</h3> <ul>
<li> <a href="operator_member_access#Address_of" title="c/language/operator member access">Address-of operator</a>. </li>
<li> <a href="operator_arithmetic#Bitwise_logic" title="c/language/operator arithmetic">Bitwise and operator</a>. </li>
</ul> <h3 id=".7C"> <code>|</code>
</h3> <ul><li> <a href="operator_arithmetic#Bitwise_logic" title="c/language/operator arithmetic">Bitwise or operator</a>. </li></ul> <h3 id=".3D"> <code>=</code>
</h3> <ul>
<li> <a href="operator_assignment#Simple_assignment" title="c/language/operator assignment">Simple assignment operator</a>. </li>
<li> In <a href="initialization" title="c/language/initialization">initialization</a>, delimit the object and the initializer list. </li>
<li> In an <a href="enum" title="c/language/enum">enum definition</a>, introduce the value of enumeration constant. </li>
</ul> <h3 id=".2B.3D"> <code>+=</code>
</h3> <ul><li> <a href="operator_assignment#Compound_assignment" title="c/language/operator assignment">Compound assignment operator</a>. </li></ul> <h3 id="-.3D"> <code>-=</code>
</h3> <ul><li> <a href="operator_assignment#Compound_assignment" title="c/language/operator assignment">Compound assignment operator</a>. </li></ul> <h3 id=".2A.3D"> <code>*=</code>
</h3> <ul><li> <a href="operator_assignment#Compound_assignment" title="c/language/operator assignment">Compound assignment operator</a>. </li></ul> <h3 id=".2F.3D"> <code>/=</code>
</h3> <ul><li> <a href="operator_assignment#Compound_assignment" title="c/language/operator assignment">Compound assignment operator</a>. </li></ul> <h3 id=".25.3D"> <code>%=</code>
</h3> <ul><li> <a href="operator_assignment#Compound_assignment" title="c/language/operator assignment">Compound assignment operator</a>. </li></ul> <h3 id=".5E.3D"> <code>^=</code>
</h3> <ul><li> <a href="operator_assignment#Compound_assignment" title="c/language/operator assignment">Compound assignment operator</a>. </li></ul> <h3 id=".26.3D"> <code>&=</code>
</h3> <ul><li> <a href="operator_assignment#Compound_assignment" title="c/language/operator assignment">Compound assignment operator</a>. </li></ul> <h3 id=".7C.3D"> <code>|=</code>
</h3> <ul><li> <a href="operator_assignment#Compound_assignment" title="c/language/operator assignment">Compound assignment operator</a>. </li></ul> <h3 id=".3D.3D"> <code>==</code>
</h3> <ul><li> <a href="operator_comparison#Equality_operators" title="c/language/operator comparison">Equality operator</a>. </li></ul> <h3 id=".21.3D"> <code>!=</code>
</h3> <ul><li> <a href="operator_comparison#Equality_operators" title="c/language/operator comparison">Inequality operator</a>. </li></ul> <h3 id=".3C"> <code><</code>
</h3> <ul>
<li> <a href="operator_comparison#Relational_operators" title="c/language/operator comparison">Less-than operator</a>. </li>
<li> Introduce a header name in </li>
<ul>
<li> a <a href="../preprocessor/include" title="c/preprocessor/include"><code>#include</code> directive</a> </li>
<li> a <a href="../preprocessor/include" title="c/preprocessor/include"><code>__has_include</code> preprocessing expression</a> <span class="t-mark-rev t-since-c23">(since C23)</span> </li>
<li> a <a href="../preprocessor/embed" title="c/preprocessor/embed"><code>#embed</code> directive</a> <span class="t-mark-rev t-since-c23">(since C23)</span> </li>
<li> a <a href="../preprocessor/embed" title="c/preprocessor/embed"><code>__has_embed</code> preprocessing expression</a> <span class="t-mark-rev t-since-c23">(since C23)</span> </li>
<li> implementation-defined locations within a <a href="../preprocessor/impl" title="c/preprocessor/impl"><code>#pragma</code> directive</a> </li>
</ul>
</ul> <h3 id=".3E"> <code>></code>
</h3> <ul>
<li> <a href="operator_comparison#Relational_operators" title="c/language/operator comparison">Greater-than operator</a>. </li>
<li> Indicate the end of a header name in </li>
<ul>
<li> a <a href="../preprocessor/include" title="c/preprocessor/include"><code>#include</code> directive</a> </li>
<li> a <a href="../preprocessor/include" title="c/preprocessor/include"><code>__has_include</code> preprocessing expression</a> <span class="t-mark-rev t-since-c23">(since C23)</span> </li>
<li> a <a href="../preprocessor/embed" title="c/preprocessor/embed"><code>#embed</code> directive</a> <span class="t-mark-rev t-since-c23">(since C23)</span> </li>
<li> a <a href="../preprocessor/embed" title="c/preprocessor/embed"><code>__has_embed</code> preprocessing expression</a> <span class="t-mark-rev t-since-c23">(since C23)</span> </li>
<li> implementation-defined locations within a <a href="../preprocessor/impl" title="c/preprocessor/impl"><code>#pragma</code> directive</a> </li>
</ul>
</ul> <h3 id=".3C.3D"> <code><=</code>
</h3> <ul><li> <a href="operator_comparison#Relational_operators" title="c/language/operator comparison">Less-than-or-equal-to operator</a>. </li></ul> <h3 id=".3E.3D"> <code>>=</code>
</h3> <ul><li> <a href="operator_comparison#Relational_operators" title="c/language/operator comparison">Greater-than-or-equal-to operator</a>. </li></ul> <h3 id=".26.26"> <code>&&</code>
</h3> <ul><li> <a href="operator_logical#Logical_AND" title="c/language/operator logical">Logical and operator</a>. </li></ul> <h3 id=".7C.7C"> <code>||</code>
</h3> <ul><li> <a href="operator_logical#Logical_OR" title="c/language/operator logical">Logical or operator</a>. </li></ul> <h3 id=".3C.3C"> <code><<</code>
</h3> <ul><li> <a href="operator_arithmetic#Shift_operators" title="c/language/operator arithmetic">Bitwise shift operator</a>. </li></ul> <h3 id=".3E.3E"> <code>>></code>
</h3> <ul><li> <a href="operator_arithmetic#Shift_operators" title="c/language/operator arithmetic">Bitwise shift operator</a>. </li></ul> <h3 id=".3C.3C.3D"> <code><<=</code>
</h3> <ul><li> <a href="operator_assignment#Compound_assignment" title="c/language/operator assignment">Compound assignment operator</a>. </li></ul> <h3 id=".3E.3E.3D"> <code>>>=</code>
</h3> <ul><li> <a href="operator_assignment#Compound_assignment" title="c/language/operator assignment">Compound assignment operator</a>. </li></ul> <h3 id=".2B.2B"> <code>++</code>
</h3> <ul><li> <a href="operator_incdec" title="c/language/operator incdec">Increment operator</a>. </li></ul> <h3 id="--"> <code>--</code>
</h3> <ul><li> <a href="operator_incdec" title="c/language/operator incdec">Decrement operator</a>. </li></ul> <h3 id=".2C"> <code>,</code>
</h3> <ul>
<li> <a href="operator_other#Comma_operator" title="c/language/operator other">Comma operator</a>. </li>
<li> List separator in </li>
<ul>
<li> the declarator list in a <a href="declarations" title="c/language/declarations">declaration</a> </li>
<li> initializer list in <a href="initialization" title="c/language/initialization">initialization</a><span class="t-rev-inl t-since-c99"><span>, including <a href="compound_literal" title="c/language/compound literal">compound literals</a></span><span><span class="t-mark-rev t-since-c99">(since C99)</span></span></span> </li>
<li> the argument list in a <a href="operator_other#Function_call" title="c/language/operator other">function call expression</a> </li>
<li> the enumerator list in an <a href="enum" title="c/language/enum">enum</a> declaration </li>
<li> a function parameter list </li>
<li> the macro parameter list in a <a href="../preprocessor/replace#Function-like_macros" title="c/preprocessor/replace">function-like macro definition</a> </li>
<li> the macro argument list in a <a href="../preprocessor/replace#Function-like_macros" title="c/preprocessor/replace">function-like macro invocation</a>, unless found between an inner set of parentheses </li>
<li> the generic association list in a <a href="generic" title="c/language/generic">generic selection expression</a> <span class="t-mark-rev t-since-c11">(since C11)</span> </li>
<li> an <a href="attributes" title="c/language/attributes">attribute</a> list <span class="t-mark-rev t-since-c23">(since C23)</span> </li>
</ul>
<li> In a <a href="_static_assert" title="c/language/ Static assert">static assertion declaration</a>, separate the arguments. <span class="t-mark-rev t-since-c11">(since C11)</span> </li>
<li> In a <a href="generic" title="c/language/generic">generic selection expression</a>, separate the controlling expression and the generic association list. <span class="t-mark-rev t-since-c11">(since C11)</span> </li>
</ul> <h3 id="References"> References</h3> <ul>
<li> C23 standard (ISO/IEC 9899:2023): </li>
<ul><li> 6.4.6 Punctuators (p: 68-69) </li></ul>
<li> C17 standard (ISO/IEC 9899:2018): </li>
<ul><li> 6.4.6 Punctuators (p: 52-53) </li></ul>
<li> C11 standard (ISO/IEC 9899:2011): </li>
<ul><li> 6.4.6 Punctuators (p: 72-73) </li></ul>
<li> C99 standard (ISO/IEC 9899:1999): </li>
<ul><li> 6.4.6 Punctuators (p: 63-64) </li></ul>
<li> C89/C90 standard (ISO/IEC 9899:1990): </li>
<ul><li> 3.1.6 Punctuators </li></ul>
</ul> <h3 id="See_also"> See also</h3> <table class="t-dsc-begin"> <tr class="t-dsc"> <td> <a href="operator_alternative" title="c/language/operator alternative"> Alternative representations</a> <span class="t-mark-rev t-since-c95">(C95)</span> </td> <td> alternative spellings for certain operators </td>
</tr> <tr class="t-dsc"> <td colspan="2"> <span><a href="https://en.cppreference.com/w/cpp/language/punctuators" title="cpp/language/punctuators">C++ documentation</a></span> for <span class=""><span>Punctuation</span></span> </td>
</tr> </table> <div class="_attribution">
<p class="_attribution-p">
© cppreference.com<br>Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.<br>
<a href="https://en.cppreference.com/w/c/language/punctuators" class="_attribution-link">https://en.cppreference.com/w/c/language/punctuators</a>
</p>
</div>
|