What does the C standard (preferably C89,90) say about:
int a,b;
a = 4;
b = (a += 1);
?
I have tested it and the result is b=5, which is what I expect. I just want to be reassured by the Standard. The same applies to analogous operators like *=, /=, &=, etc. I know that = is sure to return the value of the left hand side after the assignment. I just want to know if +=, *=, etc. behave the same way, according to the standard.
Assignment operators do not “return” a value: they yield one, or as the standard puts it, have one.
The value is of the left operand, although it won’t be an lvalue. Here’s the excerpt:
All of
= *= /= %= += -= <<= >>= &= ^= |=are assignment operators so they behave the same way in this regard.