What's a Declaration? What's a Definition?

Objects in C must have exactly one definition, and they may have mutiple external declarations.

 

Definition: occurs in only one place. specifies the type of an object; reserves storage for it; it is used to create new objects.

example: int my_array[100];

Declaration: can occur multiple times. describes the type of an object; is used to refer to objects defined elsewhere(e.g., in another file)

example: extern int my_my_array[];

 

difference between array and pointer.

 

 

你可能感兴趣的:(init)