Short circuit behavior of logical expressions in C in this example

Solution 1:

Precedence affects only the grouping. && has a higher precedence than || means:

++i || ++j && ++k

is equivalent to:

++i || (++j && ++k)

But that doesn't mean ++j && ++k is evaluated first. It's still evaluated left to right, and according to the short circuit rule of ||, ++i is true, so ++j && ++k is never evaluated.