Overview of declarators

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:

Read syntax diagramSkip visual syntax diagramDeclarator syntax
 
>>-+----------------------+------------------------------------->
   | .------------------. |
   | V                  | |
   '---pointer_operator-+-'
 
>--| direct_declarator |--+-------------+----------------------><
                          '-initializer-'
 
Direct declarator:
 
|--+-declarator_name----------------------------------+---------|
   '-direct_declarator--[--+---------------------+--]-'
                           '-constant_expression-'
 
C only

Read syntax diagramSkip visual syntax diagramPointer operator (C only):
 
|--+-*-+--+-----------------+-----------------------------------|
   '-&-'  '-type_qualifiers-'
 

Read syntax diagramSkip visual syntax diagramDeclarator name (C only):
 
|--identifier---------------------------------------------------|
 
End of C only
C++ only

Read syntax diagramSkip visual syntax diagramPointer operator (C++ only):
 
|--+-*--+-----------------+--------------------------------+----|
   |    '-type_qualifiers-'                                |
   +-&-----------------------------------------------------+
   '-+----+--nested_name_specifier--*--+-----------------+-'
     '-::-'                            '-type_qualifiers-'
 

Read syntax diagramSkip visual syntax diagramDeclarator name (C++ only):
 
|--+----------------------------------------------+-------------|
   +-identifier_expression------------------------+
   '-+----+--+-----------------------+--type_name-'
     '-::-'  '-nested_name_specifier-'
 
End of C++ only

The type_qualifiers represent one or a combination of const and volatile.

C++ 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:

IBM extension In addition, for compatibility with GNU C and C++, ILE 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



[ Top of Page | Previous Page | Next Page | Contents | Index ]