What happens if a pointer is deleted twice in a program as shown in the following C++ statements?
Posted: Wed Jul 13, 2022 7:51 pm
int *ptr = new int;
delete ptr;
delete ptr;
a) Undefined behaviour
b) Syntactically incorrect
c) Semantically incorrect
d) The program runs perfectly
delete ptr;
delete ptr;
a) Undefined behaviour
b) Syntactically incorrect
c) Semantically incorrect
d) The program runs perfectly