int main()
{
int a[max_iter][max_iter];
int temp;
const int min = 1;
const int max = 101;
srand((unsigned)time(0));
for (int i = 0;i < max_iter;i++)
for (int j = 0; j< max_iter; j++)
{
temp = min + rand() % max;
a[i][j] = temp;
cout << a[i][j] << " ";
}
getchar();
return 0;
}
/=========================================================
The above code works perfect. However, the problem turned up when I made the following change:
"#define max_iter 100" === >#define max_iter 2000
The compiler shows the warning :"Unhandled exception at 0x004116a7 in wasim2.exe: 0xC00000FD: Stack overflow." I guess the error occurred because of the overlarged size of array. But Im using 2Gb memory. Any idea? Thanks a lot:-)