Active TopicsActive Topics  Display List of Forum MembersMemberlist  CalendarCalendar  Search The ForumSearch  HelpHelp  Sitemap  Contact Us  RegisterRegister  LoginLogin
C Theory FAQs Part-I
 GenProgrammers : C : C Theory FAQs Part-I
What is the difference between the declaration and the definition of a variable?
Author Message
Faqs
Admin Group
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.


Quote Faqs Reply






bullet     Posted: 31 Dec 2007 at 11:38pm
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

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



This page was generated in 0.094 seconds.