Possible Duplicate:
How could pairing new[] with delete possibly lead to memory leak only?
delete vs delete[]
I just started learning C/C++ and I was told to use delete to delete a single object and to use delete [] for an array.
Then I found this website which asks this question
Anything wrong with this code?
T *p = new T[10]; delete p;
Note: Incorrect replies: “No, everything 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”.
Which raises the question, what does happen in that block of code? I would have logically thought that it was "Only the first element of the array will be deleted” but it seems not. Can anyone shed some light on this?