C++ Programming Question:
Download Job Interview Questions and Answers PDF
Anything wrong with this code?
T *p = 0;
delete p;
Answers:
Answer #1Yes, the program will crash in an attempt to delete a null pointer.
Answer #2Program 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
this checking will be called 2 times,by you and by language implementation
Download C++ Programming Interview Questions And Answers
PDF
Previous Question | Next Question |
Anything wrong with this code? T *p = new T[10]; delete p; | How do you decide which integer type to use? |