我在初始化一个巨大的数组时遇到了段错误。阵列初始化过程中的分段错误
对于前:
#include<iostream>
#include<limits>
using namespace std;
int main()
{
string h;
cin >> h;
int size=h.size();
cout << size << endl;
int arr[size][size];
cout << arr[0][0]<<endl;
arr[0][0]=1;
cout << arr[0][0]<<endl;
return 0;
}
当用户输入一个小弦可以说"sample"
程序工作正常。
当用户输入是一个大字符串,其大小为例如。 >1500
。在阵列初始化过程中会看到分段int arr[size][size];
问题是什么?在初始化上述数组时是否存在任何问题。