title: Memory allocation question in C++
body: <pre><code>int main() {
  
    char** k;
  
    k = new char*;
  
    char* k1 = "abc";
    char* k2 = "def";
  
    *k = k1;
    *(k + 1) = k2;
    delete [] (k + 1);
  
  
  }
  </code></pre>
  
  <p>Error: segmentation fault</p>
  
  <p>Could someone explain why I get segmentation fault when freeing (k + 1)? I was able to free k with no problems.</p>
  
  <p><strong>ADD:</strong> In the answers it has been said that I can't <code>delete [] (k + 1)</code> since I haven't used new on it; But how do you explain the fact that <code>cout&lt;&lt;*(k + 1)&lt;&lt;endl;</code> printed correctly?</p>