#include <stdio.h>
int main()
{
int i=4, j=-1, k=0, w, x, y, z;
w = i||j||k;
x = i&&j&&k;
y = i||j&&k;
z = i&&j||k;
printf("w = %d, x = %d, y = %d, z = %d", w,x,y,z);
return 0;
}
I was solving problems regarding C decision control with logical operators and I encountered a problem which I just cannot understand as the output was not something that I was expecting.
The output is:
w = 1, x = 0, y = 1, z = 1