title: confusion on memory corruption c++
body: <pre><code>class Test {
      int a ;
      int b ;
  
      public :
      Test() { }
      Test(int x , int y) : a(x),b(y) { }
  
      int getA() { return a ;}
      int getB() { return b ;}
  };
  
  int main () {
      list &lt;Test *&gt; mylist;
      Test *t1 = new Test(10,20);
  
      mylist.push_back(t1);
      delete t1 ;   //deleting the pointer
  
      list &lt;Test*&gt; ::iterator it ;
  
      for( it = mylist.begin() ; it != mylist.end() ; ++it ) {
          Test *temp = (*it) ;
          cout&lt;&lt;"taking data from list="&lt;&lt;temp-&gt;getB()&lt;&lt;endl;
      }
      return 0 ;
  }
  </code></pre>
  
  <p>I am confuse about the output of the program , after inserting pointer in the list i deleted the pointer . Ideally it should give segmentation fault but it is printing 0 .</p>