Wow. Talk about
deja vu.
My very first program was written in BASIC,
##CLASSIFIED## years ago, and it was eight lines long and took six weeks to write and it had two bugs in it. One of them was this one...
The computer has "accepted" the program, because it "can be compiled," but the program as-written probably does not mean to the computer what you
intended it to mean.
Let's look at your program
as written and see what it says
to the computer.
Code:
int a= 0;int b = 20;char x =1;char y =10;
You are declaring four variables here. Two of them are (probably) four bytes long; the other two are one byte long. All of the values will fit in the space provided. So the statement is "legal." But, what does it mean (to you)?
Code:
if(a,b,x,y) printf("hello");
This is the nonsensical statement, although no doubt you didn't intend it to be so. An
if statement needs to act upon an expression that is either
True or
False. "True" is nonzero; "False" is zero.
You have used an operator that is legal, but not appropriate to the present situation. It will evaluate, and throw away, the values of 'a', 'b', and 'x', then return the value of 'y', which as we see is '10'. This value is non-zero, so the expression is "True." The "printf()" statement will execute.
But still... what you've asked for, while
legal, is nonsensical.