What is the definition in C language? What is the meaning of the statement? What is the difference between them ?, Meaning difference
In the C language, we may be very familiar with definitions and declarations, but we may not really understand them!
Definition meaning: the so-called definition is to create (compiler) an object, allocate a memory space for this object and name it, that is, the variable name or object name we usually call, once the name matches the memory space, the name of the created variable cannot be changed in the lifecycle of the defined object or variable, and the location of the memory space will not change. Within a region (within a function, global), a name can only be defined once and cannot be defined repeatedly.
Meaning: The statement has two meanings:
The first meaning: Tell the compiler that the name has already matched a piece of memory space, and the variable or object used by the subsequent code is defined elsewhere.
Eg: extern int I:
The second meaning: Tell the compiler that this name has been reserved. For example, the most familiar function declaration: void fun (int I, char c); at the very beginning, it means to tell the compiler, this name has been reserved. Other variables or objects in the code can no longer use this name, and the declaration can be repeated multiple times.
Major differences between definitions and declarations:
Defines the creation of an object and the allocation of memory space, and declares that no memory space is allocated.
------- Summary from deep analysis of C Language