码迷,mamicode.com
首页 > 编程语言 > 详细

Relevance Between Variable Declaration and Definition in C++

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

标签:io   re   c   c++   ar   type   

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++

标签:io   re   c   c++   ar   type   

原文地址:http://www.cnblogs.com/Kai-Xing/p/3853897.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!