int j = ++val++; //gives compilation error
This is because you cannot pre-increment rvalue . ++val++ interpreted as ++(val++) because the post-increment operator has higher priority than the pre-increment operator. val++ returns rvalue , and the pre-increment operator requires its operand to be lvalue . :)
int k = ++*p++; //no error
++*p++ interpreted as ++(*(p++)) , which is quite true.
Prasoon saurav
source share