Accessing array index greater than the array size : <p>I always thought if I accessed an array index greater than the array size that it would cause a runtime error? But it seems to be happy to run and output zero. Is this compiler specific or OS specific? Will some different environments cause a runtime error when you access an array index greater than the array size?</p>

<p>For eg;</p>

<pre><code>int foo[5];
cout &lt;&lt; foo[5] &lt;&lt; endl;


vector&lt;int&gt; bar(5);
cout &lt;&lt; bar[5] &lt;&lt; endl;
</code></pre>
