1

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?

Garmekain
  • 664
  • 5
  • 18

1 Answers1

3

++x vaguely translates to x = x + 1. It does not act as a lvalue ( in C ) so you cannot assign it any value.

Prajval M
  • 2,298
  • 11
  • 32