Question 12
Back to Exercise
What is the output of the following C program when it is run as shown?
Run as: ./app alpha beta
#include <stdio.h>
int main(int argc, char **argv) {
if (argc != 3)
return 1;
printf("%s %c\n", *(argv + 2), **(argv + 1));
return 0;
}
- A alpha b
- B beta b
- C beta a Correct
- D alpha a
Correct Answer: Option C
*(argv + 2) is argv[2], the string "beta". **(argv + 1) is argv[1][0], the first character of "alpha".
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!