Difficulty: Medium
Correct Answer: r
Explanation:
Introduction / Context:
This program tests understanding of operator precedence and pointer arithmetic on C strings in argv. Specifically, it uses prefix ++ on a char (argv[1]) and then dereferences to print a single character.
Given Data / Assumptions:
Concept / Approach:
argv[1] is a char. Applying prefix ++ to a char moves it to the next character in the same string. After ++, the pointer points to the second character. Dereferencing with * yields that character.
Step-by-Step Solution:
Verification / Alternative check:
Rewriting as char *p = argv[1]; ++p; putchar(*p); confirms the same result.
Why Other Options Are Wrong:
Common Pitfalls:
Misreading ++argv[1] as ++argv then [1]; forgetting [] binds tighter than ++; confusing pre-increment with post-increment.
Final Answer:
r
Discussion & Comments