Declaration Overview

Declarations determine the following properties of data objects and their identifiers:

The lexical order of elements of a declaration for a data object is as follows:

All data declarations have the form:

   .-----------------------------.
   V                             |
>>---+-------------------------+-+------------------------------>
     +-storage_class_specifier-+
     +-type_specifier----------+
     '-type_qualifier----------'
 
   .-,---------------------------.
   V                             |
>----declarator--+-------------+-+--;--------------------------><
                 '-initializer-'
 
 

The following table shows examples of declarations and definitions. The identifiers declared in the first column do not allocate storage; they refer to a corresponding definition. In the case of a function, the corresponding definition is the code or body of the function. The identifiers declared in the second column allocate storage; they are both declarations and definitions.

Declarations Declarations and Definitions
extern double pi; double pi = 3.14159265;
float square(float x); float square(float x) { return x*x; }
struct payroll;
struct payroll {
                  char *name;
                  float salary;
               } employee;

Related References

IBM Copyright 2003