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

Discussion

What type of array is generally generated in Command-line argument?

  • A.Single dimension array
  • B.2-Dimensional Square Array
  • C.Jagged Array
  • D.2-Dimensional Rectangular Array

Answer: C

Correct answer: Jagged Array

argv is an array of pointers, and each points to a string of its own length - so the rows are of unequal length, which is what "jagged" means.

A rectangular two-dimensional array would allocate the same width for every row, wasting space on the short ones and truncating any longer than the fixed width. The pointer-of-arrays arrangement stores each argument exactly as long as it is, which is why char *argv[] is the natural declaration rather than char argv[][N].

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

Post your comment

Please log in or register to post a comment.