c=(++a + ++a);
In C++, it is undefined behaviour. I don't know behaviour of that code in java.
C++03 5 Expressions [expr]:
Paragraph 4:
....
Between the previous and next sequence point a scalar object shall have its stored value modified at most once by the evaluation of an expression. Furthermore, the prior value shall be accessed only to determine the value to be stored. The requirements of this paragraph shall be met for each allowable ordering of the subexpressions of a full
expression; otherwise the behavior is undefined.
C++11 §1.9/14 says:
Every value computation and side effect associated with a
full-expression is sequenced before every value computation and side
effect associated with the next full-expression to be evaluated.
In C++17, it is unspecified behaviour.