the program doesn't work, and as far as I understand it's because A is too large.
but
1 2 3 4 5 6
int A[3000][3000];
int main()
{
return 0;
}
Here I declare A as global array, yes? In this case, everything works just fine, no errors, program returns 0.
Why is this happening? And if I want to use arrays with large dimensions,is declaring array globally acceptable?
Thank you.
Local variables are stored on the stack which is typically smaller than the space available for global variables. Your array takes 36,000,000 bytes for 32-bit integers and twice that for 64 bit integers.
You can probably set the stack size in your compiler options.