will not compile because "there is no l-value." I think I understand this. When it tries to evaluate x + 5, you end up with a constant, and you can't use the ++ operator on a constant.
what about
1 2
int x = 2;
++( x );
why does this compile ok? Is it because nothing is being done to x inside the parenthesis so it still thinks its an l-value? Or does the compiler just ignore the parenthesis in this case?
An lvalue is any expression that can appear on the left-hand side of an assignment operator.
An rvalue is any expression that can appear on the right-hand side of an assignment operator.
operator++ requires its operand to be an lvalue. x + 5 is not an lvalue; you could not, for
example, write this line of code: