I have been given an assignment to explain how the pieces of codes work. However, I have some doubts regarding it.
int i=-3,j=2,k=0,m;
m=++i && ++j && ++k;
printf("%d %d %d %d",i,j,k,m);
This piece of code returns -2 3 1 1, about which I have no confusion, but the problem arises when I try to run the second code:
int i=-3,j=2,k=0,m;
m=++i || ++j && ++k;
printf("%d %d %d %d",i,j,k,m);
I get -2 2 0 1 here, and how is that done? the ++j and ++k must return 3 and 1 respectively, according to the theory. Could anyone please explain me how it is executed?