LearnFrenzy
Sign in Take a free test

Arrays · Array Basics MCQ · Question 11

Valid prototype to pass a 2D array to a function in C Answer, explanation & discussion

  • MCQ
  • Medium
  • 0 comments
  • Answer explained
  • Moderated community
Question 11 Back to Exercise

Which prototype can receive int m[3][4]?

  • A void f(int m[][]);
  • B void f(int **m);
  • C void f(int m[][4]); Correct
  • D void f(int m[3][]);
Correct Answer: Option C

m decays to a pointer to its first row, int (*)[4], so the column count must be known; only the first size may be left out. int ** is a different type (a pointer to pointers) and does not match.

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!

Post your comment

Comments appear after a quick review by our team.

Popular