Hi there
I am trying to write a code that in there I want to use these orders
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#include<iostream>
usingnamespace std;
int main() {
int i,j;
longdouble c[1048576][2];
for (j=0;j<2;j++)
for (i=0;i<1048576;i++)
c[i][j]=0;
c[0][0]=1;
for (j=0;j<2;j++)
for (i=0;i<1048576;i++)
cout<<c[i][j]<<",";
return 0;
}
but it fails to do.
the result is:
process returned -1073741571 <0*C00000FD> execution time : 11.191 s
There is a limit of how much memory you can put on stack. I'm not sure how much that usually is. Several MB, I think. My guess is that you array is too big. You should be fine if you allocate it dynamically though.
variables i and j are integers(-32767 to 32767) but in for loop you are trying to run the loop untill
1048576.array size is also matters because it stores on stack.