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


INTERVIEW QUESTIONS LANGUAGES C DETAILS
Question :
What is an lvalue?



Category C Interview Questions
Rating (2.6) By 5 users
Added on 7/19/2006
Views 2520
Rate it!
Answers:

example to demonstrate lvalue

#define CONSTANT_VAR 10

int var=1;

int* pntr_int=5;

CONSTANT_VAR = 15;

The variable var is an integer, which is a storable location in memory. Therefore, the statement var = 1 qualifies var to be an lvalue. Notice the second assignment statement, *pntr_int = 5. By using the * modifier to reference the area of memory that pntr_int points to, *pntr_int is qualified as an lvalue.

In contrast, observe the CONSTANT variable:

In this statements, the left side of the statement evaluates to a constant value that cannot be changed because constants do not represent storable locations in memory. Therefore, this assignment statements do not contain lvalues and will be flagged by your compiler as errors.





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
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
vii)7. main()
{
int i=-1,j=-1,k=0,l=2,m;
m=i++&&j++&&k++||l++;
printf("%d %d %d %d %d",i,j,k,l,m);
}


View Answer
viii) main()
{
char *p;
printf("%d %d ",sizeof(*p),sizeof(p));
}


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/6056/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.66