If x
is of type int
, for what I understand, ++x
is a lvalue, so
++x = 5;
is valid. But the compiler doesn't like it. It days that
lvalue required as left operand of assignment
What is happening here? Isn't ++x
an lvalue?
If x
is of type int
, for what I understand, ++x
is a lvalue, so
++x = 5;
is valid. But the compiler doesn't like it. It days that
lvalue required as left operand of assignment
What is happening here? Isn't ++x
an lvalue?
++x vaguely translates to x = x + 1. It does not act as a lvalue ( in C ) so you cannot assign it any value.