answer is 6, as it follow right to left precedence.
4 + 2 = 6
(++a + a++)
Anyone who provided a value as an answer is wrong! This is "undefined behavior" because it's a sequence error. You can't update a variable more than once inside the same sequence point. To see the proof, add the following compiler switches: -Wall -Werror and recompile the program. The compiler issues the following error message:
main.c:15:27: error: operation on ‘a’ may be undefined [-Werror=sequence-point]
int a=2; printf("%d\n", ++a + a++);
cc1: all warnings being treated as errors