#include <stdio.h> int main(void) { int i=10; if(i==(20||10)) printf("true"); else printf("false"); return 0; }
this gives output false.
please explain me how program work?
this line if(i==(20||10))
evaluates i==1
alk
said in comments - (20||10)
evaluates 1
, hence when compare i == 1
, why false
output. non-zero value in c
implies true.
perhaps wanted:
int i=10; if(i==20 || == 10) printf("true"); else printf("false");
Comments
Post a Comment