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

Discussion

If a two dimensional array is used as a formal parameter, then

  • A.the first subscript must be left empty
  • B.the first (row) subscript may be left empty
  • C.both the subscripts must be left empty
  • D.both the subscripts may be left empty

Answer: B

Correct answer: the first (row) subscript may be left empty

For a two-dimensional parameter the compiler needs the row length - the number of columns - to compute a[i][j] as *(base + i*cols + j). The number of rows is never used in that arithmetic, so void f(int a[][10]) is legal while void f(int a[10][]) is not. Leaving the first subscript out is optional, not required.

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

Post your comment

Please log in or register to post a comment.