The difference between declarations, definitions, used

Disclaimer: there is to tell, is not defined in the storage time can fool the compiler, but must find links to all defined subroutines time,

Definition: given the physical storage space

Initialization: storage space to put the initial value

Use: With space to put value

Note: you can use pre-defined, no statement, statement of purpose is to help find storage space; constant different from ordinary variables, the class inside after the completion of open space, must be initialized before use,

Range: capable of being deployed, to

Life cycle: only generate local storage space called the definition, only the beginning of life, the general definition at the beginning, as a member variable objects exist only when defined objects.

To define, in a statement prior to use, look long to live

Defined variables int a; declare variables extern a;

Defined only once, declaring class only once. Other statements multiple times

Published 128 original articles · won praise 10 · views 10000 +

Guess you like

Origin blog.csdn.net/chanleoo/article/details/103971089