title: Segmentation Fault (Core dumped) in c++
body: <p>This code when executed displays the expected output but prints <code>segmentation fault (core dumped)</code> at the end :</p>
  
  <pre><code>string str[4] = {
      "Home",
      "Office",
      "Table",
      "Bar"
  };
  
  for (int i = 0; i&lt;5; i++)
  {
      cout &lt;&lt; str[i] &lt;&lt; "\n";
  }
  </code></pre>
  
  <p><strong>Output</strong>:</p>
  
  <pre><code>Home
  Office
  Table
  Bar
  Segmentation fault (core dumped)
  </code></pre>
  
  <p>What is the signinficance of segmentation fault (core dumped). I searched and it seems an error like that occurs when you try to access unallocated memory, so, what's wrong with the above code?</p>