Mithlesh Upadhyay Mithlesh Upadhyay - 1 year ago 94
C++ Question

Is `0<0` true or false?

#include <iostream>
#include <string>

int main()
{
int i=0;
while(i++<0)
i--;
}





My attempt:

I do compile and run this program, it will be executed and printed nothing(nothing is given).

Can you explain it,
0<0
is true or false?

Answer Source

0<0 is false same as 42<42 is false (or any other equal integer). The < returns true when the LHS of the operator is less than the RHS i.e. it returns false when the LHS is greater or equal to the RHS.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download