You have to use delete []
if you allocated memory on the heap with operator new[]
(e.g. a dynamic array).
If you used operator new
, you must use operator delete
, without the square brackets.
It is not related to deleting a built-in type or a custom class.