I have seen segmentation fault sometimes during the initialization of an array with huge size.
For ex:
#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;
}
When the user input is a small string lets say "sample" the program is working fine.
When the user input is a big string where the size is for ex. >1500.Segmentation is seen during the initialization of the array  int arr[size][size];
What can be the issue?Is there any problem in initializating the array like the one above.
 
     
     
     
    