You cannot increment a temporary one that does not have an identifier . You need to save this in something to increase it. You can think of the l-value as something that can appear on the left side of the expression, but in the end you will need to think about it in terms of something that has a personality but cannot be moved (C terminology ++ 0x). Bearing in mind that it has an identifier, the link refers to the object, what you would like to save.
(- i) has no identity, therefore nothing is said there. Without referring to it with anything, there is no way to save something in it. You cannot reference (-i), so you cannot increase it.
try i = -i + 1
#include <stdio.h> int main() { int i = 10; printf("%d\n", -i + 1); // <-- No Error Here }
source share