int i=-3, j=2, k=0, m;
m = ++i || ++j && ++k;
printf("%d, %d, %d, %d\n", i, j, k, m);
Since ++
has more precedence than ||
and &&
in C, they are evaluated first and therefore the expression becomes m = -2 || 3 && 1
. Now you can apply short circuiting but that produces incorrect answer. Why is that?