(e-mail address removed) spoke thus:
{
int i=-3,j=2,k=0,m;
m=++i && ++j || ++k;
}
&& has precedence over ||, so this is equivalent to
m=(++i && ++j) || ++k;
Assuming you didn't forget a loop or something, you get
m=(-2 && 3) || 1;
so m=1 (true), i=-2, j=3, and k=1.
{
int i=-3,j=2,k=0,m;
m=++i || ++j && ++k;
}
m=-2 || (3 && 1);
which gives you the same result.
Now, if you meant something like
while( ++i && ++j || ++k );
you get
( -2 && 3 ) || 1
( -1 && 4 ) || 2
( 0 && 5 ) || 3
etc.
This is an infinite loop.
For
while( ++i || ++j && ++k );
you get
-2 || ... <- short circuit evaluation
-1 || ...
0 || ( 3 && 1 )
1 || ...
..etc
Another infinite loop. Notice that if k is -1 instead of 0, you end up with
-2 || ...
-1 || ...
0 ||| ( 3 && 0 ) <- false
so i=0, j=3, and k=0. (I have tested this ^_^)
If I screwed up somewhere, someone please correct me! (And sorry for doing
what seems like a homework problem - I just realized it, and damn if I won't
post after I wrote all this...)