Use calloc() or malloc() to dynamically allocate memory for arrays.
Arrays in C are stored with no overhead: there are no markers to separate elements, rows, columns, etc. An array is just a contigous block of data.
To use calloc(), you need to know the number of elements and the size of each element. calloc() initializes all memory to 0.
To use malloc(), you need to know the total size of the array. malloc() allocates the memory, but doesn't initialize it.
In either case, the sizeof() function can help.
If you're creating a 10 by 20 array of integers, you have 10*20 = 200 elements. Each element has a size of sizeof(int).
calloc() and malloc() both return a pointer to void. You need to cast it to the type you're using.
int *myPointer;
myPointer = (int *) calloc( sizeof(int), 200);
// or
myPointer = (int *) malloc( sizeof(int) * 200);
//
free(myPointer); //when you're done with the array
To treat the allocated memory as a two dimensional array, you'll need to do some pointer math.
See the attached example. See some additional examples
here.