When programming, we might need to compare different types of data such as char, int, double or String. We might also need to mix different types of expressions, relational operators and logical operators.
B. Summary of comparison
- char types are compared by ASCII values.
- Strings are compared by ASCII values of each character, from left to right
- When compare two double/float values, we often compare the difference with a "small enough" value because of round off errors.
- A boolean variable x== true is the same as x
C. Order of precedence:
Complete the following truth table