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

What is exit() function?

964


What is wrong with this statement? Myname = 'robin';

1263


What is difference between union All statement and Union?

1058


State the difference between x3 and x[3].

1051


Explain logical errors? Compare with syntax errors.

1009


What is the advantage of a random access file?

1128


Write the test cases for checking a variable having value in range -10.0 to +10.0?

2267


What are the types of operators in c?

1001


How can I dynamically allocate arrays?

1036


Draw a flowchart to produce a printed list of all the students over the age of 20 in a class .The input records contains the name and age of students. Assume a sentinel value of 99 for the age field of the trailer record

5153


Which header file should you include if you are to develop a function which can accept variable number of arguments?

1319


Tell me when would you use a pointer to a function?

1009


What is null in c?

1003


What is I ++ in c programming?

1058


What is a null string in c?

987