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

Discussion

Which of the following is TRUE about argv?

  • A.It is an array of character pointers
  • B.It is a pointer to an array of character pointers
  • C.It is an array of strings
  • D.None of above

Answer: A

Correct answer: It is an array of character pointers

Declared as char *argv[], argv is an array whose elements are char * - one pointer per argument, each addressing a null-terminated string.

The second option describes char **argv read too literally: as a parameter the array does decay to a pointer to its first element, but the object itself is an array of pointers. "An array of strings" is loose talk, since C has no string type; what it has is an array of pointers to characters, which is precisely the first option.

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

Post your comment

Please log in or register to post a comment.