Quote:Original post by jpetrieQuote:Original post by MARS_999
jyk look here
link
That thread is ta0lking about something else. The code you pasted above is still wrong:int count = rand() % 1000;A **array = new A*[count]; // HERE you allocate array with new[].for(int i = 0 ; i < count ; ++i) { array = new A(); // HERE, array is allocated with new.}// ...for(int i = 0 ; i < count ; ++i) { delete []array; // HERE, array is released with delete[] (WRONG)}delete []array; // HERE, array is released with delete[] (correct).
What you allocate with new, you release with delete. What you allocate with new[], you release with delete[]. Mix them, and you are wrong.
I assume you were referring to MikeP's correction of your first post in that linked thread; in that thread, you are allocating with new[] in one place and freeing with delete in another. In this thread you are doing exactly the opposite. Both are incorrect.
What are you talking about, first of all that code is his code I pasted from the rip-off
He does new with []
A **array = new A*[count];
Looks like a 2d array to me. So you will need to delete[]array[]
Unless I am missing something