Пунктуация
Материал из cppreference.com
Это символы пунктуации в C. Значение каждого символа объяснено на странице по ссылке.
{ }
- В определении struct или union разделяет список-объявления-структуры.
- В определении enum разделяет список констант перечисления.
- Разделяет составную инструкцию. Составная инструкция может быть частью определения функции.
- В инициализации разделяет инициализаторы.
[ ]
- Оператор индекса.
- Часть декларатора массива в объявлении или идентификаторе типа.
- В инициализации вводит обозначение элемента массива. (начиная с C99)
- В спецификаторе атрибутов отделяет атрибуты. (начиная с C23)
#
##
( )
- В выражении обозначает группировку.
- Оператор вызова функции.
- В выражении
sizeofor_Alignof(начиная с C11) отделяет операнд. - В явном приведении отделяет идентификатор типа.
- В составном литерале compound literal отделяет идентификатор типа. (начиная с C99)
- В объявлении или идентификаторе типа обозначает группировку.
- В объявлении функции (в объявлении или идентификаторе типа) отделяет элементы списка параметров.
- В инструкциях
if,switch,while,do-whileилиforотделяет управляющее выражение. - В определении функционально подобного макроса отделяет параметры макроса.
- Part of a
defined,__has_include, or__has_c_attribute(начиная с C23) preprocessing operator. - Part of a generic selection expression. (начиная с C11)
- In an
_Atomictype specifier, delimit the type-id. (начиная с C11) - In a static assertion declaration, delimit the operands. (начиная с C11)
- In an
_Alignasspecifier, delimit the operand. (начиная с C11) - In an attribute, delimit the attribute arguments. (начиная с C23)
;
- Indicate the end of
- a statement (including the init-statement of a for statement)
- a declaration or struct-declaration-list
- Separate the second and third clauses of a for statement.
:
- Part of conditional operator.
- Part of label declaration.
- In a bit-field member declaration, introduce the width.
...
- In the parameter list of a function declarator, signify a variadic function.
- In a macro definition, signify a variadic macro. (начиная с C99)
?
- Part of conditional operator.
- In a generic association, delimit the type-id or
defaultand the selected expression. (начиная с C11)
::
- In an attribute, indicate attribute scope. (начиная с C23)
.
- Member access operator.
- In initialization, introduce a designator for a struct/union member. (начиная с C99)
->
~
!
+
-
*
- Indirection operator.
- Multiplication operator.
- Pointer operator operator in a declarator or in a type-id.
- Placeholder for the length of a variable-length array declarator in a function declaration. (начиная с C99)
/
%
^
&
|
=
- Simple assignment operator.
- In initialization, delimit the object and the initializer list.
- In an enum definition, introduce the value of enumeration constant.
+=
-=
*=
/=
%=
^=
&=
|=
==
!=
<
- Less-than operator.
- Introduce a header name in an
#includedirective.
>
- Greater-than operator.
- Indicate the end of a header name in an
#includedirective
<=
>=
&&
||
<<
>>
<<=
>>=
++
--
,
- Comma operator.
- List separator in
- the declarator list in a declaration
- initializer list in initialization, including compound literals (начиная с C99)
- the argument list in a function call expression
- the enumerator list in an enum declaration
- the macro parameter list in a function-like macro definition
- the generic association list in a generic selection expression (начиная с C11)
- an attribute list (начиная с C23)
- In a static assertion declaration, separate the arguments. (начиная с C11)
- In a generic selection expression, separate the controlling expression and the generic association list. (начиная с C11)
References
- Стандарт C17 (ISO/IEC 9899:2018):
- 6.4.6 Punctuators (стр. 52-53)
- Стандарт C11 (ISO/IEC 9899:2011):
- 6.4.6 Punctuators (стр. 72-73)
- Стандарт C99 (ISO/IEC 9899:1999):
- 6.4.6 Punctuators (стр. 63-64)
- Стандарт C89/C90 (ISO/IEC 9899:1990):
- 3.1.6 Punctuators
See also
Шаблон:c/language/dsc operator alternativeДокументация C++ по Punctuation
|