This may be a stupid question.But still if someone can answer

if this
a = 2 + (b = 5); and
this

a = b = c = 5;

expressions are right and working fine.
Then why following is not working:
int a,b;
b=2;
a=2+b=5;
The assignment operator = is right-associative, has a lower precedence than the binary + operator,
and 2+b is not an l-value. (assuming that b is not an object of a user-defined type).

a = ( (2+b) = 5 ) ; // fully parethesized
Ok Ok.
It is because

2+b is not l-value. Got it got it. thx
Topic archived. No new replies allowed.