In my C code I am allocating memory for 2d array double E[2000][2000];
but when I run it gets a runtime error Segmentation fault(core dumped)
and when
It depends on where you allocate the array. Using stack space will probably cause an overflow (unless you get the linker to allocate an extra large stack).
For example, this might not work
int main()
{
double E[2000][2000]; // Likely an overflow
}
However, moving the array to the static memory area
double E[2000][2000];
int main()
{
// use E here
}
will probably avoid the problem.