Expand|Select|Wrap|Line Numbers
- int i=-3,j=2,k=0,m;
- m=++i||++j&&++k;
- printf("\ni=%d""\nj=%d""\nk=%d""\nm=%d",i,j,k,m);
FOR THE ABOVE CODE my compiler gives the answer as
i=-2, j=2, k= 0, m=1
At first ++i||++j is evaluated. For the || operator if one operand is non-zero the result is non-zero.hence here i is increased to -2 and ++j is not evaluated...
But after this -2 should be ANDed with k. Since for the && operation both the operands should be evaluated to find the result according to me K should be increased to 1. But here the K is not increased. Kindly clarify the reason pls