title: Deleting a char array
body: <p>This question is related to <a href="https://stackoverflow.com/questions/763213/what-would-this-code-do-memory-management">this one</a>. Given this code:</p>
  
  <pre><code>char *p = new char[200];
  delete[] p;
  </code></pre>
  
  <p>what would happen if you set <code>p[100] = '\0'</code> before deleting p? </p>
  
  <p>I had some code where I got a debug error when I tried to delete a not null-terminated char array, something about deleting heap memory that's not assigned. It seemed to delete memory out of the array's bounds.</p>