VC++ 6.0 new & delete HELP!

Started by
1 comment, last by JZ... 24 years, 2 months ago
Hello - Im trying to work with 2 dimensional arrays and Im STUCK! I keep gettin assertion failed errors when i try to delete the array? Any Suggestions? PieceClass **piece; int i; piece = new PieceClass *[MAX_WIDTH]; for (i=0;i = new PieceClass [MAX_HEIGHT]; for (i=0;i; // <– fails here 1st time through delete [] piece; this same method works fine for a 2 dimensional structure but not this class. What am I doing wrong? JZ… </i>
Advertisement
Looks like some of your code got mangled in the post, but when you delete the rows, are you using delete [] there as well:

for (int i = 0; i < width; ++i) delete [] piece;<br><br>delete [] piece;<br>  </pre>  <br><br>-Brian<br><br>Edited by - osmanb on 3/9/00 9:35:30 PM   <br><br>Edited by - osmanb on 3/9/00 9:36:02 PM    

that was it - (even with the warped post)
for some reason i used that code on an array of structs and it worked fine but not that class -
thanks!
JZ...

This topic is closed to new replies.

Advertisement