Difficulty: Easy
Correct Answer: 30
Explanation:
Introduction / Context:
This expression combines dereferencing and arithmetic. In C, whitespace is irrelevant; ij
is parsed as i * *j
(multiplication by the dereferenced value). Understanding operator precedence avoids misreading the expression.
Given Data / Assumptions:
Concept / Approach:
Multiplication is left-associative, and unary (dereference) applies to
j
to yield 3. So evaluate products first, then addition.
Step-by-Step Solution:
Compute *j = 3Multiply i * *j → 3 * 3 = 9Multiply by i again → 9 * 3 = 27Add j → 27 + 3 = 30Print 30
Verification / Alternative check:
Introduce temporaries: a = j; printf("%d\n", iai + a); gives the same result.
Why Other Options Are Wrong:
(b) stops before the final addition. (c) and (d) ignore parts of the expression. (e) does not arise from the given arithmetic.
Common Pitfalls:
Misreading as an exponent operator (C has none), or as double-dereference; here the two stars are separate operators.
Final Answer:
30
Discussion & Comments