Declarators

A declarator designates a data object or function. Declarators appear in all data definitions and declarations, and in some type definitions.

You cannot declare or define a volatile or const function.

Class member functions can be qualified with volatile or const.

A subscript declarator describes the number of dimensions in an array, and the number of elements in each dimension.

A simple declarator consists of an identifier, which names a data object. For example, the following block scope data declaration uses initial as the declarator:

auto char initial

The data object initial has the storage class auto, and the data type char.

The following table describes some more declarators:

Example Description
int owner owner is an int object.
int *node node is a pointer to an int data object.
int names[126] names is an array of 126 int elements.
int *action( ) action is a function returning a pointer to an int.
volatile int min min is an int that has the volatile qualifier.
int * volatile volume volume is a volatile pointer to an int.
volatile int * next next is a pointer to a volatile int.
volatile int * sequence[5] sequence is an array of five pointers to volatile int objects.
extern const volatile int op_system_clock op_system_clock is a constant and volatile int with static storage duration and external linkage.

 



Declarations Overview
Block Scope Data Declarations
File Scope Data Declarations
Storage Class Specifiers
Initializers
Type Specifiers


Arrays