Deleting pointers from an array
<p>I am fairly new to C++, and this problem I am having has had me stumped for like the last 2 hours.  What I am trying to do is create an array of pointers to my class Word objects, so a 2 dimensional array, which is <code>**wordPtrList</code>. Then I need to delete the memory of certain objects in the array and set their pointers to null. I have written a smaller version of what I am trying to accomplish below.  </p>

<pre><code>int main()
{
    char *cArray;
    cArray = new char[4];
    int i;

    for (i = 0; i &lt; 3; i++)
        cArray[i] = 'a';

    cArray[i + 1] = '\0';   //cArray is a null terminated string

    Word **wordPtrList;
    wordPtrList = new Word* [3];

    for (i = 0; i &lt; 3; i++)
    {
        wordPtrList[i] = new Word(cArray);
    }

    wordPtrList[1]-&gt;del();
    delete wordPtrList[1];
    wordPtrList[1] = '\0';

    return 0;
}

class Word
{
private:
    char* ptr_;
    int len_;
public:
    Word(const char* word)
    {
        len_ = strlen(word);
        ptr_ = new char[len_];      
        strcpy(ptr_, word);
    }
    ~Word()
    {
        delete [] ptr_;
        ptr_ = 0;
    }


    void del()
    {
        delete [] ptr_;
        ptr_ = 0;
        return;
    }

};
</code></pre>

<p>When I do this however, I get: </p>

<blockquote>
  <p>Debug Error Heap Corruption Detected after normal block</p>
</blockquote>

<p>This is in VS 2010 on Windows 7.  </p>

<p>So what I am asking is, how do I delete the memory of my object so that I can set <code>wordPtrList[1]</code> to Null?</p>
