Why not causing a segmentation error? : <pre><code>#include &lt;iostream&gt;
using namespace std;

int main(){
    int a[3], no;
    cout  &lt;&lt; "Index Value\n";
    for(int i = 0; i &lt; 100; i++){
        cin &gt;&gt; no;
        a[i] = no;
        cout &lt;&lt; i &lt;&lt; "\t" &lt;&lt; a[i] &lt;&lt; endl;
    }
    return 0;
}
</code></pre>

<p>Here I initialized <strong>a[ 3 ]</strong>.  In for loop, I'm feeding input 100 times to <strong>a[ ]</strong>, exceeding the indices of <strong>[ 3 ]</strong>.<br>
Why don't it give segmentation error right after <em>when i equals 4</em>.<br>
<strong><em>Input</em></strong><br>
<code>1 2 3 4 5 6 7</code><br>
<strong><em>Output</em></strong><br>
<code>Index Value
 0 1
 1 2
 2 3
 4 0
 5 5
 6 6
 7 7</code>
<br>
Output is wrong when Index equals 4. <em>Printed 0 . Expected 4</em></p>
