What will happen if the following C++ statement is compiled and executed?
What will happen if the following C++ statement is compiled and executed?
int *ptr = NULL;
delete ptr;
Show answerHide answer
Correct answer: (B) The program is compiled and executed successfully
Explanation
Deleting a null pointer is a no-op that the C++ standard guarantees to be safe. The code compiles and runs normally.