I am trying to define two dynamic 2-dimensional arrays using malloc and here is the code (I know that M = 118 and N = 186):
int **Cf;
Cf = (int **) malloc(M * sizeof(int *));
for (i = 0; i < N; i++)
Cf[i] = (int *) malloc(N * sizeof(int));
The array Cf allocates memory with no problem. However, my program crashes when it comes to Ct. I debugged the code and found out that Ct[i] = (int *) malloc(N * sizeof(int))
fails when N=164
which is kinda weird.