Skip to main content\(
\newcommand{\lt}{<}
\newcommand{\gt}{>}
\newcommand{\amp}{&}
\definecolor{fillinmathshade}{gray}{0.9}
\newcommand{\fillinmath}[1]{\mathchoice{\colorbox{fillinmathshade}{$\displaystyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\textstyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\scriptstyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\scriptscriptstyle\phantom{\,#1\,}$}}}
\)
Section 1.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
If = statement, is Left Hand Side (LHS) a variable? Check data type of copied value against data type of variable
Update variable for post operators based on side effect
Exercises Exercises
1.
2.
3.
4.
Q4: Given the following, what value is stored in variable detla?
int a = 0, b = 1, c = 2, d = 3, delta;
delta = (d / c)++ - (a % ++b);
1.5
2.5
1
2
Compiler error - will not compile
5.
Q5: Which of the following are syntactically valid ways to increment the value of eta
by one? Select all that apply.
eta++;
eta + 1;
++eta;
++eta--;
eta = eta + 1;
You have attempted
of
activities on this page.