C++ - freeing dynamic memory

Started by
19 comments, last by Khatharr 10 years, 11 months ago


Am I freeing ptr1-3, when freeing ptr4?


From what I read in C++ Primer Plus this wouldn't work since ptr2,ptr3, and ptr4 are not considered pointers but ordinary int variables, the statement would have to be:
int* ptr1 = NULL, *ptr2 = NULL, *ptr3 = Null, etc...

Aye. Although if we ignore that then the answer is still no:

You don't delete pointers. You delete allocations.

Also:

[attachment=15341:pointing-to-god-1.jpg]

void hurrrrrrrr() {__asm sub [ebp+4],5;}

There are ten kinds of people in this world: those who understand binary and those who don't.

This topic is closed to new replies.

Advertisement