Machine-translated by Google. Questions are authored in English.
Top

Discussion

What does the second parameter of the main function represent?

  • A.Number of command line arguments
  • B.List of command line arguments
  • C.Dictionary of command line arguments
  • D.Stack of command line arguments

Answer: B

Correct answer: List of command line arguments

The second parameter is argv, an array of pointers to the argument strings - one pointer per argument, in the order typed.

argv[0] holds the program name and argv[argc] is guaranteed to be a null pointer, so the list can be walked either by counting to argc or by stopping at the null. The count is the first parameter, and C has no dictionary or stack type to offer.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.