Listing 11 Demonstrates why you shouldn't use operator delete with arrays

#include <iostream. h>

class T
{
public:
   T() {cout << "Default constructor" << endl;}
   ~T(){cout << "Destructor" << endl;}
};

main()
{
   T *p = new T[3];
   delete p; /* CHANGED */
   return 0;
}

/* Output:
Default constructor
Default constructor
Default constructor
Destructor
Null Pointer Assignment
*/

/* End of File */