We can assign the memory dynamically for a 1 dimensional array in the following way:
int *a;
int i; //Can be any value
a = (int *)malloc (i * sizeof(int));
Dynamic allocation of arrays of more than one dimension is not so easily done, because dynamic allocation of an n-dimensional array actually requires dynamic allocation of n 1-dimensional arrays. To allocate a 2-dimensional array you must first allocate memory sufficient to hold all the elements of the array (the data), then allocate memory for pointers to each row of the array. For arrays of more than two dimensions it gets more complicated.