A declaration makes a name known to a programm. A definition creates the assocatied entity. A variable declaration specifies the variable type and name. In addition to specifying the variable type and name, a definition also allocates storage and may provide an initial value. So in this sense, a definition is also a declaration. A variable must be defined exactly once but can be declared many times. And the difference between definition and declaration can be easilly understood by the following case.
To use the same variable in mutliple files, we must define this variable in one and only one file. Other files that use this variable must declare but not define this variable.
Relevance Between Variable Declaration and Definition in C++,布布扣,bubuko.com
Relevance Between Variable Declaration and Definition in C++
原文地址:http://www.cnblogs.com/Kai-Xing/p/3853897.html