Declaration Syntax

Declarations are a powerful, expressive, and therefore often poorly understood, aspect of the C language. A declaration is a language construct that asserts the existence of a set of identifiers and specifies their interpretation and attributes for later use. Declarations can declare identifiers for objects, functions, type aliases, structures, unions, and enumerations. Additionally, declarations can cause storage to be reserved for objects, assign initial values to objects, and specify the implementation of functions.

A declaration consists of two parts; the first component is a set of declaration specifiers, which name a qualified base type, and the second component is a list of declarators, each of which introduces a new identifier.

declaration:

declaration-specifiers

[ init-declarator-list ]

;

For example, int x, *y, z[5]; declares three identifiers, “x”, “y”, and “z”, as referring to objects of type int, int* (pointer to int), and int[5] (array of 5 int), respectively.

Declaration Decomposition Rule

Any list of multiple declarators may be decomposed into an exactly equivalent sequence of declarations with the same declaration specifiers; for example, int x, *y, z[5]; is exactly equivalent to int x; int *y; int z[5];.