Section 2.22 Assessment: Pre/Post Operators
Subgoals for evaluating an assignment statement.
- Determine resultant data type of expression
- Update variable for pre operators based on side effect
- Solve arithmetic equation, operator precedence
- Is the Left Hand Side (LHS) of the assignment statement a variable? Check the data type of the value on right hand side (RHS) against data type of LHS variable.
- Update variable for post operators based on side effect
Exercises Exercises
- 3
- 2
- 1
- 0
- eta++;
- eta + 1;
- ++eta;
- eta += 1;
- eta = eta + 1;
2.
3.
4.
Q4: Given the following, what value is stored in variable delta?
int a = 0;
int b = 1;
int c = 2;
int d = 3;
int delta;
delta = d / --c - a % ++b;
5.
Q5: Which of the following are syntactically valid ways to increment the value of
eta
by one? Select all that apply.You have attempted 1 of 2 activities on this page.