When allocating multidimensional arrays with malloc, calloc, and realloc, a common pattern is to allocate the inner arrays with multiple calls (even if the call only appears once, it may be in a loop):
/* Could also be `int **` with malloc used to allocate outer array. */
int *array[4];
int i;
...