I m a total newbie to a C++ world (and C too). And don\'t know all its details. But one thing really bothers me.
It is constructions like :
while (a=b) {...}
.
The assignment operators in C and C++ return the value of the variable being assigned to, i.e., their left operand. In your example of a = b
, the value of this entire expression is the value that is assigned to a
(which is the value of b
converted into the type of a
).
So you can say that the assignment operator "returns" the value of its left operand.
In C++ it's a little more complicated because you can overload the =
operator with an actual user-defined function, and have it return something other than the value (and type) of the left operand.