Hi there,
I'm experiencing a weird segmentation fault. The following code runs fine
Code:
#include <stdlib.h>
#include <stdio.h>
main()
{
int matrixSize = 1000;
int i,j;
double a[matrixSize][matrixSize];
for (i = 0; i < matrixSize; i++)
for (j = 0; j < matrixSize; j++)
a[i][j] = rand() % 10;
return 0;
}
But when I try to initialize one more 2D array, I get "segmentation fault" exception:
Code:
#include <stdlib.h>#include <stdio.h>
main()
{
int matrixSize = 1000;
int i,j;
double a[matrixSize][matrixSize];
for (i = 0; i < matrixSize; i++)
for (j = 0; j < matrixSize; j++)
a[i][j] = rand() % 10;
double b[matrixSize][matrixSize];
for (i = 0; i < matrixSize; i++)
for (j = 0; j < matrixSize; j++)
b[i][j] = rand() % 10;
return 0;
}
Could anybody tell me what's the issue here? Any help would be greatly appreciated..
Thank you in advance.