#include <stdio.h>
int main(void) {
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 am trying to learn about associativity and precedence of operators in C. Here, The output comes out to be -2 3 0 1
, but I think the output should be -2 3 1 1
because k
is also pre-incremented. Why that won't be the answer? Thanks!