#include <stdio.h> int main() { int i = 10; printf("%d ", ++(-i)); // <-- Error Here }
What is wrong with ++(-i)? Please clarify.
++(-i)
-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.
-i
++
2.1m questions
2.1m answers
60 comments
57.0k users