title: Maximum size of local array variable
body: <p>When I try to run this I get a segmentation fault:</p>
  
  <pre><code>#define FILE_NAME "test.html"
  #define STRING_ARRAY_SIZE 1000000
  
  int main() {
  fstream file;
  string line = "";
  string string_array [STRING_ARRAY_SIZE];
  int i = 0;
  
  file.open(FILE_NAME);
  while(getline(file, line)) {
      string_array[i] = line;
      i++;
      cout &lt;&lt; line &lt;&lt; endl;
  }
  
  file.close();
  }
  </code></pre>
  
  <p>Instead, when I try to compile this, it works:</p>
  
  <pre><code>#define FILE_NAME "test.html"
  #define STRING_ARRAY_SIZE 100000
  
  int main() {
  fstream file;
  string line = "";
  string string_array [STRING_ARRAY_SIZE];
  int i = 0;
  
  file.open(FILE_NAME);
  while(getline(file, line)) {
      string_array[i] = line;
      i++;
      cout &lt;&lt; line &lt;&lt; endl;
  }
  
  file.close();
  }
  </code></pre>
  
  <p>Turns out, the only difference is the size of the array. Why does it work when it is 100000, and it does not when it is 1000000? What is the maximum size? Thank you.</p>