Declarations - Syntax


     declaration_specifiers declarator_list;



A declaration specifier may be as simple as one of the basic data types:

int i,j;
double A=1.0,B=2.0;

where, for the first statement, integer is the declaration specifier and i,j forms the declarator list. The second statement has double as the declaration specifier and A=1.0,B=2.0 as the declarator list (which also supplies initializers for each item in the list).

The existence of a class may be signalled to the compiler prior to its definition being given, as in:

class test;

where the declarator list is empty. Such is legal for classes and enumerated types, and is useful when attempting to avoid the problem of circularities within class declarations.

Apart from the type, the declaration specifier may include specifiers which alter the meaning of that which is being declared. For example, a storage class specifier may be supplied in addition to the basic type name as follows.

static int i=0;
external int j;

For the above example, the integer i has internal linkage. The integer j has external linkage, may be defined in another translation unit and yet be accessed within the current translation unit.