Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

what is the difference between declaration and definition
of a variable or function ?

Answer Posted / michael scofield

definition defines the memory area ( allocates the memory ) for the variable and the declaration tells about the signature of the variable ( type and size to be considered). definition occures once through the program( memory is allocated once ), but the declaration can occur many times.
OR For a variable, the definition is the statement that actually allocates memory. For example, the statement:
long int var;
is a definition. On the other hand, an extern reference to the same variable:
extern long int var;
is a declaration, since this statement doesn&#65533;t cause any memory to be allocated. Here&#65533;s another example of a declaration:
typedef MyType short;

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

define string ?

1064


how can I convert a string to a number?

1045


Differentiate between declaring a variable and defining a variable?

1003


Is c high or low level?

974


What does void main () mean?

1196


Which is best linux os?

984


What is the difference between Printf(..) and sprint(...) ?

1457


What are the advantages of union?

1033


a program that can input number of records and can view it again the record

1875


Differentiate between the = symbol and == symbol?

1228


Does sprintf put null character?

998


What are the rules for identifiers in c?

1041


What is pass by reference in functions?

794


Differentiate between static and dynamic modeling.

1068


List out few of the applications that make use of Multilinked Structures?

2130