In C++, what does the delete operator do ?
2025
In C++, what does the delete operator do ?
Answer: B. Frees dynamically allocated memory — The delete operator in C++ is used to deallocate memory that was previously allocated using the new operator. It calls the destructor for the object and frees…
- A.
Deletes a member of a class
- B.
Frees dynamically allocated memory
- C.
Deletes the class definition
- D.
Deallocates an object
Attempted by 195 students.
Show answer & explanation
Correct answer: B
The delete operator in C++ is used to deallocate memory that was previously allocated using the new operator. It calls the destructor for the object and frees the memory back to the heap.
Loading lesson…