Explain what happens when a pointer is deleted twice?



Explain what happens when a pointer is deleted twice?..

Answer / Mohammad Asad

Deleting a pointer twice causes undefined behavior in C++. The first deletion frees the memory allocated to the object that the pointer points to. When the same pointer is deleted again, the program may crash or exhibit unpredictable behavior.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C++ General Interview Questions

What is the best c c++ compiler for windows?

1 Answers  


What are iterators in c++?

1 Answers  


What are all predefined data types in c++?

1 Answers  


why the size of an empty class is 1

4 Answers  


What are guid?

1 Answers  


Why do we use templates?

1 Answers  


What will happen if a pointer is deleted twice?

1 Answers   Agilent, HAL,


How would you implement a substr() function that extracts a sub string from a given string?

1 Answers  


Explain what are mutator methods in c++?

1 Answers  


In how many ways we can initialize an int variable in C++?

1 Answers  


What is a class template?

1 Answers  


Explain what you mean by a pointer.

1 Answers   TCS,


Categories