← BYTES
C++·Starter·Ref: 8.1.14
What does the `delete` operator do in C++?
Have a question about this video? Mention reference 8.1.14 when you contact us.
a.Calls an object's destructor and then releases the heap memory that was allocated for it via new
b.Removes a variable name from the source code
c.Deletes a class definition entirely
d.Clears a variable's value without freeing memory
`delete ptr;` runs the pointed-to object's destructor (releasing any resources it owns) and then frees the underlying heap memory -- the counterpart to `new`, and must be matched with it (never free() or delete[] on a plain new'd object).
Find this on YouTube & Instagram
Every BYTES video is tagged with its reference number and topic — search any of these on YouTube or Instagram to find this one:
#BYTES#BYTES8114#C