ProgrammingVery hard

Which prototype is valid in C99 for a function that takes a column count c and an int matrix m with c columns?

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

Correct answer: C. void f(int c, int m[][c]);

A variable-length array parameter may use an earlier parameter as its size. The size c must be declared before the array that uses it, and the inner dimension can not be left empty.

More C Programming questions

Exams that ask this topic