Vidyalelo
C++ Programming · Q79

Object Oriented Programming in C++

Programming · C++ Programming · question 79

Q79

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;

A.
Undefined behaviour
Answer
B.
Syntactically incorrect
C.
Semantically incorrect
D.
The program runs perfectly

Answer: Option A

Solution

Answer: Option A
No explanation is given for this question Let's Discuss on Board