C++ Programming Question:
Download Questions PDF

Anything wrong with this code?
T *p = 0;
delete p;

C++ Programming Interview Question
C++ Programming Interview Question

Answers:

Answer #1
Yes, the program will crash in an attempt to delete a null pointer.

Answer #2
Program will work just fine,if we write if(p !=0) delete p; then
this checking will be called 2 times,by you and by language implementation

Download C++ Programming Interview Questions And Answers PDF

Previous QuestionNext Question
Anything wrong with this code?
T *p = new T[10];
delete p;
How do you decide which integer type to use?