title: munmap_chunk(): invalid pointer on delete[]
body: <p>Compiling works fine. 
  Running this program results in:</p>
  
  <pre><code>*** Error in `a.out': munmap_chunk(): invalid pointer: 0x00007ffdc19fa7b0 ***
  </code></pre>
  
  <p>after printing the numbers 0 to 34 as I would expect. As far as I understand the error occurs on </p>
  
  <pre><code>delete[] myp;
  </code></pre>
  
  <p>I don't know what I am missing. What am I doing wrong?</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  using namespace std;
  
  class MyClass{
  public:
    int value;
    MyClass(int v): value(v) {};
  };
  
  int main (){
    int nc=35;
  
    MyClass *myp[nc];
  
    for(int i=0; i&lt;nc; i++)
      {
        myp[i] = new MyClass(i);
      }
  
    for(int i=0; i&lt;nc; i++)
      {
        cout &lt;&lt; myp[i]-&gt;value &lt;&lt; endl;
      }
  
    delete[] myp;
  }
  </code></pre>