Question 2
Back to Exercise
What is the output of the following C program when it is run as shown?
Run as: ./app Learn Frenzy 2026
#include <stdio.h>
int main(int argc, char *argv[]) {
for (int i = 1; i < argc; i++)
putchar(argv[i][0]);
putchar('\n');
return 0;
}
- A LF2 Correct
- B LearnFrenzy2026
- C .LF2
- D LF
Correct Answer: Option A
argv[i] is a string, so argv[i][0] is its first character: L, F and 2.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!