Difficulty: Easy
Correct Answer: BC
Explanation:
Introduction / Context:
This problem checks pointer arithmetic with character arrays. Incrementing a char moves to the next character. The code displays two successive characters after a starting position passed by the caller.
Given Data / Assumptions:
Concept / Approach:
For char, a++ advances to the next element (next character). The first increment moves from A to B; the second increment moves from B to C. Printing *a after each step reveals those elements.
Step-by-Step Solution:
Start: a points to a[0] = 'A'.a++ → points to a[1] = 'B'; print 'B'.a++ → points to a[2] = 'C'; print 'C'.Concatenated output: "BC".
Verification / Alternative check:
Replace prints with indices to confirm the sequence of positions: 1 then 2, corresponding to B then C.
Why Other Options Are Wrong:
"AB" would require printing before increment; "CD" would require starting at C; "No output" is false because printf is executed.
Common Pitfalls:
Forgetting that the first print happens after one increment, not at the initial element.
Final Answer:
BC
Discussion & Comments