Declarations are constructs in a program that state that a name identifies an object, type or function, and describe that entity. Every declaration has a scope, which indicates in which lexical portion of a source file the declared name has its declared meaning.
- translation-unit
external-declaration
translation-unit external-declaration
- external-declaration
function-definition
declaration
- declaration
declaration-specifiers init-declarator-listopt
-
static_assert-declaration
since C11 - declaration-specifiers
storage-class-specifier declaration-specifiersopt
type-specifier declaration-specifiersopt
type-qualifier declaration-specifiersopt
function-specifier declaration-specifiersopt
alignment-specifier declaration-specifiersopt
- storage-class-specifier
typedef
extern
static
_Thread_
local auto
register
- init-declarator-list
init-declarator
init-declarator-list , init-declarator
- init-declarator
declarator
declarator = initializer
- declarator
pointeropt direct-declarator
- direct-declarator
identifier
( declarator )
-
direct-declarator [ type-qualifier-listopt assignment-expressionopt ]
-
direct-declarator [ static type-qualifier-listopt assignment-expression ]
-
direct-declarator [ type-qualifier-list static assignment-expression ]
-
direct-declarator [ type-qualifier-listopt * ]
direct-declarator ( parameter-type-list )
-
direct-declarator ( identifier-listopt )
The pre-standard way - initializer
assignment-expression
{ initializer-list }
-
{ initializer-list , }
since C99 - initializer-list
designationopt initializer
initializer-list , designationopt initializer
- designation
designator-list =
- designator-list
designator
designator-list designator
- designator
-
[ constant-expression ]
. identifier