Why do statements after return change the return value?
<p>C++ returns invalid value in the following code:</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;vector&gt;

using namespace std;

int f(){
    vector&lt; int * &gt; v[2];
    return 1;
    v[1].push_back(NULL);
}

int main(){
    cout &lt;&lt; f();
}
</code></pre>

<p>The output is:</p>

<pre><code>205960
</code></pre>

<p>When I commnet line after return, it works fine:</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;vector&gt;

using namespace std;

int f(){
    vector&lt; int * &gt; v[2];
    return 1;
    //v[1].push_back(NULL);
}

int main(){
    cout &lt;&lt; f();
}
</code></pre>

<p>The output is:</p>

<pre><code>1
</code></pre>

<p>I am using code::blocks with mingw32-g++.exe compiler. The mingw version is: gcc version 4.4.1 (TDM-2 mingw32).</p>
