A C code is written:
int i=-1 , j=-1 ,k=0 ,l=2 ,m;
m=i++ && j++ && k++ || l++; //Line 3
printf("%d%d%d%d%d",i,j,k,l,m);

O/p= 00131.
I figured out that the Last variable in Line 3 is incremented only if it is preceeded by || else if preceeded by && it is not incremented.

But if we take 3 variables the result is just reverse;
int i=-1 , j=-1 ,k=0 ,m;
m=i++ && j++ && k++; //Line 3
printf("%d%d%d%d",i,j,k,m);

O/p:0010. (and abt the value of m ,its totally unpredictable.

May be I'm wrong interpreting.PLz Some one tell me the exact functioning going on behind

Comments
no code tags, insulting thread title

This is not reply of my question..Plz reply only if u can explain.Thnx.

Comments
insulting
When you're getting free help, you may not dictate the terms.

This is a prime example of "write-only-code" and whoever wrote it should be shot on the spot.
I executed the code on VS2010 and wrote an if-cascade that does the same (on this compiler)

i=-1; j=0; k=0; l=2;
	m=0;
	if(i&&j)
	{
		if(j&&k)
		{
			m=1;
		}
		k++;
	}
	i++;
	j++;
	if(l)
	{
		m=1;
	}
	l++;
	printf("%d%d%d%d%d\n",i,j,k,l,m);

NOTE: if you have more than one (pre-)post-increments in one statement, then the behaviour is undefined, that means the following line will result in different outputs on different compilers or even wors on different runs of the same program.
VERY BAD.

m=i++ && j++ && k++ || l++;
Comments
This post is factually incorrect.

NOTE: if you have more than one (pre-)post-increments in one statement, then the behaviour is undefined, that means the following line will result in different outputs on different compilers or even wors on different runs of the same program.
VERY BAD.

m=i++ && j++ && k++ || l++;

This claim is incorrect. In fact, it's incorrect in two different ways:

1) There is nothing wrong with having as many increments or decrements you like in a single statement, so long as no two of them refer to the same variable.

2) The correct rule is that if you modify a variable's value in an expression, you are not allowed to access it (either read or write) elsewhere in the same expression unless (a) a sequence point intervenes, or (b) you are accessing it in order to compute its new value.

There is a sequence point between the left and right operands of && and || as well as between the operands of the comma operator.

So i++ + j++ is fine, so long as i and j are not references to the same variable. Moreover, i++, i++ is also fine, because there is a sequence point between the operands of the comma. Similarly, i++ && i++ and i++ || i++ are OK for the same reason. Finally, i = i * 3 - 1; is OK because i is accessed in order to compute its new value.

This article has been dead for over six months. Start a new discussion instead.