Quote:
This code gives me result 14. But I hope that result will be 12.
This code:
int a = ++i + ++i;
is in a gray zone, this means that the result is unpredictable and will depend on how it is handled by compiler. Result can be 12, 13 or 14.
Advice: Never do multiple increment/decrement on same variable in a formula.