首页 > 编程语言 > 详细

Relevance Between Variable Declaration and Definition in C++

时间:2014-07-19 17:22:07      阅读:236      评论:0      收藏:0      [点我收藏+]

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!