ProgrammingModerate

int **m = malloc(3 * sizeof *m); for (int i = 0; i < 3; i++) m[i] = malloc(4 * sizeof **m); What is the number of allocation calls made in total?

  1. A. 3
  2. B. 4
  3. C. 7
  4. D. 12

Correct answer: B. 4

One malloc for the array of row pointers, and one for each of the three rows, makes 4 calls.

More C Programming questions

Exams that ask this topic