![]() |
Active Topics Memberlist Calendar Search |
|
|
| C Theory FAQs Part-I | |
| What is the difference between the declaration and the definition of a variable? | ||
| Author | Message |
|
Faqs
Admin Group
Admin Joined: 13 Apr 2006 Location: India Online Status: Offline Posts: 14411 |
|
|
The definition is the one that actually allocates space, and provides an initialization value, if any.
There can be many declarations, but there must be exactly one definition. A definition tells the compiler to set aside storage for the variable. A declaration makes the variable known to parts of the program that may wish to use it. A variable might be defined and declared in the same statement. ![]() Posted: 31 Dec 2007 at 11:38pm
|
|
IP Logged |
|
|
||
Select Category |
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
|