1. Statement:
In general, the name behind is added with the extern keyword, such as:
extern int // just a statement .
This process, which is a declaration, tells the compiler that the variable has been defined somewhere else, and that this only makes a basic declaration, and that the process does not allocate memory for it.
2. Definition:
int // declaration + Definition
The definition is complete, in fact, the definition contains the declaration, and the compiler allocates memory for it.
3. Initialize:
int ten;
Initialized, the defined memory is allocated later, let alone initialized.
4, one-step completion:
extern int 3.14;
It is generally done with declarations, definitions, initializations, and, of course, allocating memory.
5, the essence of the difference
The difference between declaring, defining, initializing, and essentially having no allocated memory. Obviously, the declaration simply tells the compiler that there is such a variable or function declaration, only to tell the compiler that there is such a function, the function or variable is defined in other places, so in the process did not allocate memory for it, definition, the compiler will allocate memory space for its variables. Initialized, it is completed, and the allocated memory is filled with the specified assignment.
6. Understanding
The declaration is understood as: a generic declaration that tells the compiler that this variable is an object created elsewhere.
The definition is understood as: a special declaration that allocates memory for a declared variable.
Declaration, definition of the nature of the difference: there is no memory allocation