O'Reilly logo

SAMS Teach Yourself C++ in 10 Minutes SECOND EDITION by Jesse Liberty

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Deleting Arrays

It's a common mistake to forget to delete an array:

char *SomePointer = new char[25];
delete SomePointer;

This will delete the zeroth element of SomePointer and leave the other 24 characters of the array taking up space in the heap. Eventually, there will be no more room in the heap, and the program will stop running. This is called a memory leak.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required