Difficulty: Easy
Correct Answer: myprog 10 20 30
Explanation:
Introduction / Context:
This common argv-processing loop prints each C-string in the argv array from index 0 up to index argc - 1. Because argv[0] is the program name, it appears first in the output, followed by all user-supplied arguments.
Given Data / Assumptions:
Concept / Approach:
The loop indexes from 0, so the very first printed string is argv[0], not argv[1]. Thus the printed sequence begins with "myprog" before the numeric arguments.
Step-by-Step Solution:
Verification / Alternative check:
Changing the loop to start at i = 1 would skip the program name; as written, it includes it.
Why Other Options Are Wrong:
Common Pitfalls:
Assuming argv[0] is not part of argc/argv; forgetting that printing begins at index 0 in this loop.
Final Answer:
myprog 10 20 30
Discussion & Comments