I wrote a C code that usea a matrix of double:
double y[LENGTH][4];
whith LENGTH=200000
I have no problem.
I have to increase the numbers of rows to LENGTH=1000000
but when I enter this value and execute the program it returns me segmentation fault.
I tried to allocate more memory using malloc
:
double **y = (double **)malloc(LENGTH * sizeof(double*));
for(int i = 0; i < LENGTH; i++){
y[i] = (double *)malloc(4 * sizeof(double));
}
I run the the code above and after some second of calculations it still gives me "segmentation fault". Could anyone help me?