I want to have a large 2 dimensional array such like
int myArray[10000][2];
I was told that the array built in such way is not appropriate, and should use malloc to build in heap. Could someone show me how to accomplish this? thanks!
#include <stdlib.h>
//alloc
int **vv = malloc(2 * sizeof(int *));
for(int i = 0; i < 2; i++)
vv[i] = malloc(10000 * sizeof(int));
//free
for(int i = 0; i < 2; i++)
free(vv[i]);
free(vv);