I tested in the online C compiler.
The result printed was 7.
int a=2; printf("%d", ++a + a++);
The explanation is that
++a: uses the incremented value of "a" AND increments the value of "a" in one step
a++: uses the incremented value of "a" . After the expression is evaluated and assigned, it THEN increments a
So in order of what happens
"++a" "+" "a++"
a starts at 2
the expression increments a and sets a to that increment. so the first term "++a" has been evaluated to 3, also a=3 now
3 "+" "a++"
now we plug 3 into a
3 "+" "3++" which is
3 "+" "4"
since that is the end of the expression, it returns the value 3+4 = 7, to the print function.
then it changes a to 4. (by incrementation)
HOWEVER
int a=2; printf("%d", ++a + a++ + a);
would result in 11 at the end.
the difference is after a++, there is more expression(s) to be evaluated.
so before it goes to the next expression, it sets a to 4.
so we have the 7 from before, and its added by an a. and since the a = 4, we have 7+4 = 11