CoolInterview.com - World's Largest Collection of Interview Questions
Send Free SMS
 Interview Questions  
 Our Services  


INTERVIEW QUESTIONS LANGUAGES C DETAILS
Question :
What is the difference between declaring a variable and defining a variable?



Category C Interview Questions
Rating (0.0) By 0 users
Added on 7/19/2006
Views 1567
Rate it!
Answers:

By using declaration we can the name and type of a variable.But it does not allocate space.

By using definition we can allocate space for the variable



by declaration we mean specifying data type of variable and memory is allocated in this stage only except for pointers which have dynamic memory allocation
eg: int a[10];
in this 20 bytes are kept aside for a

defining means putting values into variable



 Posted by: JAYA GOYAL    

Contact JAYA GOYAL  Contact JAYA GOYAL


If you have the better answer, then send it to us. We will display your answer after the approval.
Name :*
Email Id :*
Answer :*
Verification Code Code Image - Please contact webmaster if you have problems seeing this image code Not readable? Load New Code
Process Verification  Enter the above shown code:*
Inform me about updated answers to this question

   
Related Questions
View Answer
What is a const pointer?
View Answer
What is an lvalue?


View Answer
When is a switch statement better than multiple if statements?


View Answer
Can static variables be declared in a header file?


View Answer
Difference between Funtion to pointer and pointer to function

View Answer
What is #line used for?


View Answer
Can a variable be both const and volatile?


View Answer
All the programs are tested under Turbo C/C++ compilers.
It is assumed that,
?? Programs run under DOS environment,
?? The underlying machine is an x86 system,
?? Program is compiled using Turbo C/C++ compiler.
The program output may depend on the information based on this assumptions (for example sizeof(int) == 2 may be assumed).

Predict the output or error(s) for the following:

i) void main()
{
int const * p=5;
printf("%d",++(*p));
}


View Answer
main()
{
float me = 1.1;
double you = 1.1;
if(me==you)
printf("I love U");
else
printf("I hate U");
}


View Answer
vi) main()
{
extern int i;
i=20;
printf("%d",i);
}


View Answer

Please Note: We keep on updating better answers to this site. Subscribe to our newsletter to get notified when better answer is posted.

Notify me when better answer is posted!
Email:

View ALL C Interview Questions

User Options
Sponsored Links


Copyright ©2003-2010 CoolInterview.com, All Rights Reserved.
Privacy Policy | Terms and Conditions
Page URL: http://www.coolinterview.com/interview/6058/default.asp?cachecommand=bypass


Download Yahoo Messenger | Placement Papers| FREE SMS | ASP .Net Tutorial | Web Hosting | Free SMS | Dedicated Servers | Joke of the Day

0.67