#include <stdio.h>
int main()
{
int a = -3, b = 2, c = 0, d;
d = ++a || ++b && ++c;
printf("%d %d %d %d", a, b, c, d);
return 0;
}
The output of program is:
-2 2 0 1
Compiler is evaluating the OR (||
) operator before AND (&&
) but the AND (&&
) operator comes before OR (||
) in operator precedence.
Please do explain why this happens.