ProgrammingVery hard

Which parameter declaration accepts an int a[3][4] argument from main without a warning?

  1. A. void f(int (*m)[4]);
  2. B. void f(int **m);
  3. C. void f(int *m[5]);
  4. D. void f(int m[][3]);

Correct answer: A. void f(int (*m)[4]);

An int[3][4] decays to a pointer to its first row, an int (*)[4]. int ** is a different type, and int *m[4] is an array of pointers; int m[][3] fixes the wrong row width.

More C Programming questions

Exams that ask this topic