PROGRAM
#include
int main(void)
{
int i, j, k;
i = 1; j = 1; k = 1;
printf(\"%d \", ++i || ++j && ++k);
printf(\"%
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.