$\require{cancel}$

Your New Friend new and their Partner delete

  • The real strength of a pointer is the ability to deal with dynamic memory.
  • This is memory allocated from the heap.
  • BUT FIRST
  • The following are common errors:
  • When you allocate memory
  • new and new[]
  • delete and delete[]
  • Simple memory allocation demo array.cpp.