In either case, the elements of the dynamic array can be accessed with normal-looking array subscripts: arrayx[j] (for 0 <= i < NROWS and 0 <= j < NCOLUMNS).

If the double indirection implied by the above schemes is for some reason unacceptable, you can simulate a two-dimensional array with a single, dynamically-allocated one-dimensional array:

int *array3 = (int *)malloc(nrows * ncolumns * sizeof(int));​

However, you must now perform subscript calculations manually, accessing the i,jth element with array3[i * ncolumns + j]. (A macro could hide the explicit calculation, but invoking it would require parentheses and commas which wouldn't look exactly like multidimensional array syntax, and the macro would need access to at least one of the dimensions, as well.)

but the syntax starts getting horrific and at most one dimension may be specified at run time.

With all of these techniques, you may of course need to remember to free the arrays when they are no longer needed, and you cannot necessarily intermix dynamically-allocated arrays with conventional, statically-allocated ones

All of these techniques can also be extended to three or more dimensions. Hope that helped.

For more on Arrays and Pointers the following would make a good read :