pre-increament & post-decreament

int a=2,b;
b= a++ + ++a + a++;

According to me output should be 5,10. But output given in 5,9. Why?

Refer this thread and the links mentioned on the same. You can never be sure of the order of evaluation in such expressions which have undefined behaviour and where the value of a variable is getting modified more than once between two sequence points which is not allowed/defined as per the standards. However, compiling the code on ideone gives 5,10 as the output, this may differ on other compiler too!!