Hello I've never used dynamics 2-dimension array in C, so I need your help. How can I build 2-dimension array with allocating memory?
I thought about something like this :
int ** dynamic_allocate_array(int n, int m) {
int **A = (int **) malloc(n*sizeof(int *));
int i;
for (i = 0; i < n; i++) {
A[i] = (int *) malloc (m*sizeof(int));
}
return A;
}
But my program crushes due to allocating the memory. I need your advice!