You dynamically create 2d arrays as a pointer to chunk of int*
pointers which point to a chunk of int
s.
So there are two steps:
1) A
to point to the first of a chunk of int*
int **A = (int **)malloc(N * sizeof(int*));
2) each of them to point to the first of a chunk of int
s
for(i=0; i<N; i++){
A[i] = (int *)malloc(N * sizeof(int));
}