I'm writing a code for finite difference scheme to approximate a PDE solution. For this purpose I need to create a double array of larger size as I refine my mesh. The problem is that I get Segmentation fault: 11 as I go over double array of size 1000. I created this trivial code to identify my problem. Please let me know how I can work this problem around
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main()
{
int n, a=2000,i=0;
double T=40;
double time =25, k = T/(a-1);
double Array[a][a];
time=25;
n=(time/k);
for(i=0;i<a;i++)
{
Array[i][i]= 2+i;
}
printf("%d\n", n);
printf("%lf\n", Array[600][600]);
}
Note that a =1000 or less works just fine. Also my partner is working on fortran and does not encounter the same problem.
Thanks