It's also called a heap. This is the memory that your application can allocate and deallocate dynamically (using new/delete operators or their equivalents).
There should be "=" instead of ":", anyway in this snippet you:
- create a pointer,
- create a new Cat object,
- initialize the pointer to make it point to that object
- and finally you destroy that Cat object leaving a dangling pointer (i.e. a non-null pointer that doesn't point to any object).
Here you simply create a pointer without initializing it (and without disturbing any cats). This is also a dangling pointer, because it points to some random address (although some compilers might set it to 0, but you shouldn't rely on that).
Bookmarks