User talk:Malik gawhar

I asked some people about the basic C Program which i have listed below but no one was able to give its true answer this program is listed below: void main { int x=2; int y=2; int z=2; if(x==y==z) { printf("true"); //if condition is true } else { printf("false"); //if condition is false } getch; }
 * 1) include
 * 2) include

I said this to many people but all told me that it's output will be true but it is wrong it's output will be false because of this reason: Firstly in assignment operator it can check only two values or compare only two conditions and in the above program as we have written that if(x==y==z) so here first the x will be compared with y as 2==2 and the output will become true and we all know that the output is 1 for true and 0 for false.Now so x==y the output will be 1 and then this 1 will compare with the value of z so this equation will become(1==2) so here the condition goes wrong. so this is the cause that it prints false as an output.