In this code:
int y = 10; int z = (++y * (y++ + 5)); What I expected
First y++ + 5 will be executed because of the precedence of the innermost parentheses. So value of y will be 11 and the value of this expression will be 15. Then ++y * () will be executed. So 12 * 15 = 180. So z=180
What I got
z=176
This means that the VM is going from left to right not following operator precedence. So is my understanding of operator precedence wrong?
y++, since basic math doesn't have mutable variables (as far as I know).A() + B() * C()guarantees that the multiplication operation happens before the addition. The invocation ofA()is neither a multiplication nor an addition, so precedence says nothing whatsoever about whetherA()happens beforeB()andC().