Task
Let a
, b
, c
, and d
be variables of type int
.
- Which of the following character sequences are valid expressions in the sense that they are accepted by a C++ Compiler? Explain your answer.
- a = b = 5
- 1 = a
- ++a + b++
- a + b = c + d
- a = 2 b
Assume that all the variables have been defined and correctly initialized and that all expressions are completely independent from each other.
-
For each of the expressions that you have identified as valid, decide whether the entire expression is an
lvalue
or anrvalue
, and explain your decision. -
Determine the values of the expressions that you have identified as valid and explain how these values are obtained.