int val = -10;
cout << ++(-val) << endl;
Output should be 11
. But it gives me an error.
int val = -10;
cout << ++(-val) << endl;
Output should be 11
. But it gives me an error.
The error is "lvalue required as increment operand". This means that it's just a value; it does not represent a particular object like "val" anymore so trying to change it makes no sense to the compiler.