title: How to detect and isolate C++ Access Violation Error
body: <p>While i was developing a C++ application, </p>
  
  <p>I was using a simple <code>list&lt;int&gt; *somelist = new list&lt;int&gt;();</code>
  that contains data. </p>
  
  <p>I was trying to iterate this list using something like this:</p>
  
  <pre><code>for (list&lt;int&gt;::iterator j=somelist-&gt;begin();j!=somelist-&gt;end();j++)
  {
      //do something with *j
  }
  </code></pre>
  
  <p>When i was doing something with the pointer <code>j</code> because of a chain reaction the data that i was going to access was removed from the list and no longer exists.</p>
  
  <p>So, i am being prompted with an Access Violation Error Msg. </p>
  
  <p>Can someone tell me how to identify if the pointer <code>j</code> is a bad ptr </p>