Skip to content
Related Articles
Get the best out of our app
GFG App
Open App
geeksforgeeks
Browser
Continue

Related Articles

C++ | new and delete | Question 4

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

What happens when delete is used for a NULL pointer?




int *ptr = NULL;
delete ptr; 


(A) Compiler Error
(B) Run-time Crash
(C) No Effect


Answer: (C)

Explanation: Deleting a null pointer has no effect, so it is not necessary to check for a null pointer before calling delete.

Quiz of this Question

My Personal Notes arrow_drop_up
Last Updated : 28 Jun, 2021
Like Article
Save Article
Similar Reads