Evaluation order and operator priority are two different things.
Your best guess is true. All multiplicative * / % operators have the same priority and are linked from left to right. Additive operator - has a lower priority. Unary operator ! binds more strongly than multiplicative or additive operators. And the assignment operator = has a very low priority (but even higher than the comma operator).
So this is:
z = !x + y * z / 4 % 2 - 1
equivalent to this:
z = (!x) + (((y * z) / 4) % 2) - 1
But the operands can be evaluated legally in any order (with the exception of some operators, such as && , || which impose an evaluation from left to right). If the operands are simple variables, this probably doesn't matter, but something like:
z = func(x) * func(y);
two function calls can be executed in any order.
source share