It seems like the compilers handle it differently. Let's divide the statement and, try to figure it out.
First, you use the Prefix Increment Operator - which means that the increment operation should occur before the use of the value of i
. But, how much before?
It seems like the first compiler increments the values directly before they are used. So, as we have two +
operators, the first two increments are performed before the first +
operator and the third increment is performed before the second +
operator. What gives us: 3 + 3 + 4 = 10
.
The second compiler performs the whole of the increments at the beginning of the statement. What gives us: 4 + 4 + 4 = 12
.