A c program output is unexpected to me
i was going through a c objective book where a question comes
#include<stdio.h>
#include<conio.h>
int main()
{
int i,j,k;
i=j=k=1;
k=++i||++j&&++k;
printf("%d %d %d",i,j,k);
return 0;
}
out put: 2 1 1 in my view
1) k is incremented
2) j is incremented
3)i is incremented
4) k&&j will happen
5) i|| (k&&j)
so output should be i=2,j=2,k=1. what i am missing?
No comments:
Post a Comment