title: Delete and invalid pointer
body: <pre><code>int main()
  {
      char* a=new char[20];  
      cin&gt;&gt;a;  
      cout&lt;&lt;" character at 7-th position."&lt;&lt;a[6];  
      delete a+4;  
      cout&lt;&lt;a[0];
      return 0;
  }
  </code></pre>
  
  <p>Input:</p>
  
  <pre><code>1234567894567 
  </code></pre>
  
  <p>Output: </p>
  
  <pre><code>character at 7-th position.6  
  *** glibc detected *** ./test free() invalid pointer:....  
  </code></pre>
  
  <p>Now I have 3 questions </p>
  
  <ol>
  <li>Is it correct that <code>delete a+4</code> will only delete the character at <code>a+4</code>?  </li>
  <li>If answer to previous one is yes then what happens to <code>a[0]</code>.We should get the output.  </li>
  <li>to delete a chunk of memory we should write <code>delete[]</code>.But in this case how come all the elements are deleted?     </li>
  </ol>