/* Example taken from http://www.ihypress.net/programming/c/prog.php?chap=09&pgm=06 Dynamic allocation of a 2D array */ /* (Computer Scientist's Method) */ #include #include /* Dynamic allocation of arrays of more than one dimension can also be done using a pointer pointing to an array of pointers and each pointer of that array pointing to an array of values. With that method you can use the real 2-D subscripts like array[i][j] */ int main (void) { int nrows, ncols, i, j; int **numbers; /* pointer to the first cell ([0][0]) */ printf ("How many rows and columns?> "); scanf ("%d%d", &nrows, &ncols); /* allocating the array of pointers */ numbers = (int **) calloc (nrows, sizeof(int *)); /* allocating the array of integers */ for (i=0; i