int main() {
int i = -3, j = 2, k = 0, m;
m = ++i || ++j && ++k;
printf(\"%d %d %d %d\\n\", i, j, k, m);
return 0;
}
i thought tha
C does short-circuiting of logical expressions, so evaluation of ++i
is enough to figure out that m
should be true.
m = ++i || ++j && ++k;
Since &&
has higher precedence than ||
so the expression is interpreted as ++i || (++j && ++k)
||
is short circuiting and so right hand operand of ||
operator doesn't get evaluated because ++i
returns a non zero value.