Difficulty: Medium
Correct Answer: u
Explanation:
Introduction / Context: The expression ++argv[2] combines array indexing, prefix increment, and dereferencing on a pointer to char. Understanding operator precedence and the effect of incrementing a char is crucial.
Given Data / Assumptions:
Concept / Approach: [] binds more tightly than ++, so we first get argv[2] (a char), then apply prefix ++ to move within the string, and finally use * to read the character now pointed to.
Step-by-Step Solution:
argv[2] initially points at 't' in "tuesday".++argv[2] moves to the next character, which is 'u'.++argv[2] yields 'u'.Verification / Alternative check: Assign char *p = argv[2]; ++p; putchar(*p); to observe the same result without compact operators.
Why Other Options Are Wrong:
Common Pitfalls: Misinterpreting ++argv[2] as ++argv then [2]; forgetting pre-increment advances before dereference.
Final Answer: u
Discussion & Comments