|Q1:||Why use unnecessary parentheses when precedence will determine which operators are acted on first?|
|A1:||Although it is true that the compiler will know the precedence and that a programmer can look up the precedence order, code that is easy to understand is easier to maintain.|
|Q2:||If the relational operators always return 1 or 0, why are other values considered true?|
|A2:||The relational operators return 1 or 0, but every expression returns a value, and those values can also be evaluated in an if statement. Here's an example:
if ( (x = a + b) == 35 )
This is a perfectly legal C++ statement. It evaluates to a value even if the sum of a and b is not equal to 35. Also note that x is assigned the value that is the sum of a and b in any case. ...