#include <stdio.h>
int main()
{
int i = 10;
printf("%d\n", ++(-i)); // <-- Error Here
}
What is wrong with ++(-i)
? Please clarify.
-i
generates a temporary and you can't apply ++
on a temporary(generated as a result of an rvalue expression). Pre increment ++
requires its operand to be an lvalue, -i
isn't an lvalue so you get the error.