Deallocating memory from a private class variable
<pre><code>#include &lt;stdio.h&gt;
#include &lt;iostream&gt;
#include &lt;string&gt;


using namespace std;

class myClass{

public:
    int *num1;
    myClass();


};

myClass::myClass(){
    num1 = new int[1];
    num1[0] = 10;
}


int main()
{
    myClass *myclass;

    myclass = new myClass[10];

    cout &lt;&lt; myclass[0].num1[0] &lt;&lt; endl;

    delete &amp;myclass[0];
    cout &lt;&lt; myclass[0].num1[0] &lt;&lt; endl;

}
</code></pre>

<p>I want to delete the first instance of myclass (myclass[0]).</p>

<p>This code does not run correctly, it fails during the delete part. There is probably something I am missing. </p>

<p>What did I do wrong? </p>
