Possible Duplicate:
Double comparison
int x=-1;
if(0<=x<=9)
std::cout<< "Without Logical operator";
if (0<=x && x<=9)
std::cout<< "With Logical operator";
I know about 2nd if It’s working fine.
What’s happening here in the 1st if condition . It goes inside 1st if besides x is -1
And why compiler is not giving error when using (0<=x<=9)
In C, boolean values are just plain integers. In boolean context,
0is false, and all other values are true. In this case,