C++ Programming Question: Download Questions PDF
Anything wrong with this code?
T *p = new T[10];
delete p;
![C++ Programming Interview Answer C++ Programming Interview Question](https://globalguideline.com/public/images/interview/24.png)
Answers:
Answer #1Everything is correct, Only the first element of the array will be deleted”, The entire array will be deleted, but only the first element destructor will be called.
Answer #2T ** p = new T[10];
delete [] p;
delete [] p;
Download C++ Programming Interview Questions And Answers
PDF
Previous Question | Next Question |
What problems might the following macro bring to the application? | Anything wrong with this code? T *p = 0; delete p; |