Tom Kelliher, CS 116
Oct. 18, 2000
Nothing new. Should have read up to 5.4.
Scope and access.
Logical operations, assignments, statements.
Suppose we know the following:
int i = 5; int j = -3; int k = 12;What are the values of the following expressions?
k - i * 2 i - 4 - j 4 / i * 5 i - 2 * k + jWhy?
How can we change the order of evaluation?
+, -, *, /, %.
   
Implicit type conversion. ``Smaller'' to ``larger'' types.
Casts are unary operators.
Example: generating a random integer from 1 to 10 (inclusive).
   Math.random() generates a random double such that
    .  How can we use it to solve this
   problem?
.  How can we use it to solve this
   problem?
-, ++, -- (and casts).
Use increment and decrement judiciously.
Unary arithmetic operators have higher precedence than binary.
Associativity?
abs(), ceil(), floor.
Comparison and boolean operators.
<, <=, ==, !=, >, >=.
Equality, inequality one level below others.
boolean.
Why is 0.0 < x < 1.0 illegal?
Examples. Assume:
int n = 3; double x = 4.8;Evaluate (explain):
n < 3 n <= 3 n < x (n + 3) == 2 2 * n != x - 1.0 n >= n n / 4 > 0 n >= n == n < 3
boolean argument(s).  Return a boolean value.
&&, ||.
Lower precedence than equality, inequality.
Associate?
!.
Unary precedence.
Associate?