August 2001
Beginner
482 pages
10h 52m
English
Relational operators are used to determine whether two numbers are equal, or if one is greater or less than the other. Every relational expression returns either 1 (true) or 0 (false). The relational operators are presented in Table 4.1. |
If the integer variable myAge has the value 39, and the integer variable yourAge has the value 40, you can determine whether they are equal by using the relational “equals” operator:
myAge == yourAge; // is the value in myAge the same as in yourAge?
This expression evaluates to 0, or false, because the variables are not equal. The expression
myAge > yourAge; // is myAge greater than yourAge? ...
Read now
Unlock full access