Difficulty: Easy
Correct Answer: monday tuesday wednesday thursday
Explanation:
Introduction / Context:
This question reinforces how argc and argv are commonly used to step through command-line arguments. The code decrements argc in the loop condition and advances the argv pointer before dereferencing, thereby skipping the program name and printing the remaining arguments in order.
Given Data / Assumptions:
Concept / Approach:
The pattern while (--argc > 0) { printf("%s", *++argv); } is idiomatic. Pre-decrement drops the count to the number of remaining args, while pre-increment moves argv past argv[0] before dereference, so the loop prints argv[1], argv[2], argv[3], argv[4].
Step-by-Step Solution:
Verification / Alternative check:
Adding a space in the format string ("%s ") would make the separation explicit; the logical sequence remains the same.
Why Other Options Are Wrong:
Common Pitfalls:
Forgetting that *++argv both skips argv[0] and marches forward each iteration; confusing visual spacing with the underlying order.
Final Answer:
monday tuesday wednesday thursday
Discussion & Comments