My question is inspired from the below code
int a=4;
int d=(++a) + (++a); // stored value 12
a=4;
int e=++a + a++; //Actual stored value 11
a=4;
int f=a++ + a++; //Actual stored value 9
a=4;
int g=a++ + ++a; //Actual stored value 10
I have seen that the precedence of postfix operator is more than prefix operator . Hence ,
'd' in my opinion should be (5+6)
'e' in my opinion should be (6+4)
'f' in my opinion should be (4+5)
'g' in my opinion should be (4+6)
I am using gcc 7.4.0
Can anyone please help with how to reason the non-matching results ?
NOTE: The variables in which the expression(d,e,f,g) is being stored is not the same as the variable involved in expression(a).