freelanceprogrammers.org Forum Index » C

c-doubt


View user's profile Post To page top
modmsrec Posted: Sat Jul 12, 2003 7:56 am


Joined: 12 Jul 2003

Posts: 1
c-doubt
hi guys
y does a>b:a=100:(b=200); does not give an error &
a>b:(a=100):b=200;gives an error of lvalue required.

bye
Reply with quote
Send private message
View user's profile Post To page top
tej_is_here Posted: Mon Jul 21, 2003 12:03 am


Joined: 21 Jul 2003

Posts: 1
c-doubt
Hello,
 
Did u mean to say
1)       a>b ? a=100:(b=200); does not give an error &
2)       a>b ? (a=100):b=200; does give an error of lvalue required ?
If so,
In the first case,
 
a & b are compared & depending on its truth value a=100 or b=200 is evaluated. here a=100 & b=200 are considered as 2 simple statements.The parenthesis covering b=200 indicated that b=200 is a single simple stmt.
 
But where as in second case,
 
first a & b are compared and depending on its truth value 2 simple stmts ( a=100 or b) is evaluated. but then, the whole conditional stmt at LHS is being assigned a value 200. But the stmt at LHS (a>b ? (a=100):b) is not a variable, so it flags an error saying a location value is required on the LHS.
 
Regards,
Tejaswinee.
>hi guys>y does a>b:a=100:(b=200); does not give an error &>a>b:(a=100):b=200;gives an error of lvalue required.
>bye
 
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
Reply with quote
Send private message
Post new topic Reply to topic
Display posts from previous:   
 

All times are GMT
Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Freelace Website Designer - Customer web design and software building.
Booking Calendar - reservation calendar script
Land Surveying - total station instruments and equipments
China Wholesale - Electronics Products
Character Studio - Tutorials and Help