Difficulty: Easy
Correct Answer: f
Explanation:
Introduction / Context:
This tests pointer manipulation with argv and double dereference. argv is a pointer to pointers (char). After increment, it points at the first user argument; dereferencing once yields a char, and dereferencing twice yields the first character of that string.
Given Data / Assumptions:
Concept / Approach:
++argv advances from &argv[0] to &argv[1]. * (single) yields argv[1] which is "friday". ** (double) indexes the first character of "friday". Hence the character printed is 'f'.
Step-by-Step Solution:
Verification / Alternative check:
Replacing with printf("%c", argv[1][0]); under the initial argv yields the same result 'f'.
Why Other Options Are Wrong:
Common Pitfalls:
Mixing up pre-increment and array indexing order when working with pointer-to-pointer structures like argv.
Final Answer:
f
Discussion & Comments