1 #include <stdlib.h>
2
3 int **array;
4 array = malloc(nrows * sizeof(int *));
5 if(array == NULL)
6 {
7 fprintf(stderr, "out of memory\n");
8 exit or return
9 }
10 for(i = 0; i < nrows; i++)
11 {
12 array[i] = malloc(ncolumns * sizeof(int));
13 if(array[i] == NULL)
14 {
15 fprintf(stderr, "out of memory\n");
16 exit or return
17 }
18 }
19