◄Up► ◄Contents► ◄Index► ◄Back► ─────C/C++ Language───────────────────────────────────────────────────────── A declaration specifies certain attributes of an identifier but does not allocate storage. The extern keyword tells the compiler to defer allocation. An initializer is not allowed in a declaration. For example: extern int y; // Names a variable. Defers storage // allocation. extern const start; // Names a constant. Defers storage // allocation. struct person; // Names a structure type. The members // are not defined and the size of // the struct is not known. int sum( int, int ); // Names a function and specifies return // type and number and type of // parameters. Parameter names are // recommended but not required. For a variable, a definition provides both a name and a type that allow the compiler to allocate a section of memory that is large enough to accommodate the type. An initializer is allowed in a definition. For example: int x; // Allocates an integer. int y = 0; // Allocates and initializes an integer. const start = 1; // Allocates and initializes a constant. struct person // Defines a structure type and allocates { // a variable of that type. long phone; char *name; } customer; For a function, a definition provides everything that a declaration provides, plus a function body. For example: int sum( int a, int b ) { return a + b; } -♦-