I have the folliwing code:
void main()
{
int a=30,b=40,x;
x=(a!=10) && (b=50);
printf("x=%d",x);
}
Here in the result I get x=1
. In &&
operator the condition true only when both are true here the first is true i.e a not equal to 10 , but second is b=50
which is wrong then also the value of x
is 1 in out put. Why is this happening ?