Relational operators and logical operators, being C++ expressions, each return a value: 1 (true) or 0 (false). Like all expressions, they have a precedence order that determines which relations are evaluated first. This fact is important when determining the value of the statement

if ( x > 5 && y > 5 || z > 5)

It might be that the programmer wanted this expression to evaluate true if both `x` and `y` are greater than 5 or if `z` is greater than 5. On the other hand, the programmer might have wanted this expression to evaluate true only if `x` is greater than 5 and if it is also true that either `y` is greater than 5 or `z` is greater than 5.

If `x` is 3, and `y` and `z` are both 10, the first interpretation will be true (`z` is greater than ...

Start Free Trial

No credit card required