What happens if a pointer is deleted twice in a program as shown in the following C++ statements?
int *ptr = new int;
delete ptr;
delete ptr;
int *ptr = new int;
delete ptr;
delete ptr;A. Undefined behaviour
B. Syntactically incorrect
C. Semantically incorrect
D. The program runs perfectly
Answer: Option A

Join The Discussion