++i and i++ are different because you increment it before the number is changed right?
So here it would make sense that:
++i(5+1) + ++i((5+1)+1) + ++i((5+1)+1)+1) and another +1 because you add another one to the value of i itself(the new value)
so instead of 21, there is another increment of 1, so 22.
see http://www.cplusplus.com/doc/tutorial/operators/ for more info.
You have A + B + C.
We know that the code has to evaluate A and B before A + B
and that C and A + B have to be evaluated before X + C.
Other than those restrains, the order of evaluations is up to implementation; it could return 24 too.
In other words, do not attempt multiple ++ or -- for same variable in one expression.