A declarator designates a data object or function. A declarator can also include an initialization. Declarators appear in most data definitions and declarations and in some type definitions.
For data declarations, a declarator has the form:
Declarator syntax >>-+----------------------+-------------------------------------> | .------------------. | | V | | '---pointer_operator-+-' >--| direct_declarator |--+-------------+---------------------->< '-initializer-' Direct declarator: |--+-declarator_name----------------------------------+---------| '-direct_declarator--[--+---------------------+--]-' '-constant_expression-'
Pointer operator: |--+-*-+--+-----------------+-----------------------------------| '-&-' '-type_qualifiers-'
Declarator name: |--identifier---------------------------------------------------|
Pointer operator: |--+-*--+-----------------+--------------------------------+----| | '-type_qualifiers-' | +-&-----------------------------------------------------+ '-+----+--nested_name_specifier--*--+-----------------+-' '-::-' '-type_qualifiers-'
Declarator name: |--+----------------------------------------------+-------------| +-identifier_expression------------------------+ '-+----+--+-----------------------+--type_name-' '-::-' '-nested_name_specifier-'
The type_qualifiers represent one or a combination of const and volatile.
A nested_name_specifier is a qualified
identifier expression. An identifier_expression can
be a qualified or unqualified identifier.
Initializers are discussed in Initializers.
The following are known as derived declarator types, and are therefore discussed in this section:
In addition, for compatibility with GNU C and C++, XL C/C++ allows you to use variable
attributes to modify the properties of data objects. As they are normally
specified as part of the declarator in a declaration, they are described in
this section, in Variable attributes.
Related information