what is return a=true?

I understand
 
  return a==true;

But what is a return statement as below?
 
  return a=true;

Does it mean first to assign true to a, then return true?

Thanks,

L
Equivalent to return ( a = true ) ;
Assign true to a; return the result of the assignment (the result of the assignment is typically a reference to a).
JLBorges wrote:
return the result of the assignment (the result of the assignment is typically a reference to a

"Typically", meaning all integral types, most if not all of the standard library, and most classes.
I suddenly got this. This is like what happen to" return a++;" and "return ++a".

Thanks,
L
a++ would return a not incremented and ++a would return a incremented.
> I understand
> return a==true;
I don't. Surely you may do return a;
ne555 wrote:
I don't. Surely you may do return a;

I think the OP means he/she understands what it does.
Last edited on
Topic archived. No new replies allowed.