previous | start | next

## Pointers and Memory Allocation

- The special value `NULL` indicates that a pointer doesn't point anywhere.
- Instead of leaving pointers uninitialized, you should always set them to `NULL` when you define them.

  >     Employee* boss = NULL; // will set later
  >     . . .
  >     if (boss != NULL) name = boss->get_name(); // OK

- You cannot dereference a `NULL` pointer.

  >     Employee* boss = NULL;
  >     string name = boss->get_name(); // NO!! Program will crash

previous | start | next