Figure 5: A write to heap storage that is no longer allocated

/* To compile: CRTBNDCPP PGM(EXAMPLE5) */
#include 

int main (int argc, char *argv[])
{
  char *ptr = new char[16];
  delete [] ptr;
  strcpy(ptr, "abc");  /* reuse of deallocated memory */
  return 0;
}