default initialization in C++
<p>I have a question about the default initialization in C++. I was told the non-POD object will be initialized automatically. But I am confused by the code below. </p>

<p>Why when I use a pointer, the variable i is initialized to 0, however, when I declare a local variable, it's not. I am using g++ as the compiler. </p>

<pre><code>class INT {
    public: int i;

};

int main () {

    INT* myint1 = new INT;
    INT myint2;
    cout&lt;&lt;"myint1.i is "&lt;&lt;myint1-&gt;i&lt;&lt;endl;
    cout&lt;&lt;"myint2.i is "&lt;&lt;myint2.i&lt;&lt;endl;

    return 0;
}
</code></pre>

<p>The output is </p>

<p>myint1.i is 0</p>

<p>myint2.i is -1078649848</p>
