Home | Projects | Notes > C++ Programming > Pointers

Pointers

 

Overview

 

What is a Pointer?

 

Why Use Pointers?

 

Declaring Pointers

 

Accessing Pointer Address

 

sizeof a Pointer Variable

 

Storing an Address in a Pointer Variable (Typed Pointers)

 

Dereferencing a Pointer

 

Dynamic Memory Allocation (new & delete)

Allocating storage from the heap at run-time

Relationship between Arrays and Pointers

 

Subscript & Offset Notation Equivalence

 

Pointer Arithmetic

 

const and Pointers

There are several ways to qualify pointers using const.

Passing Pointers to a Function

Example

 

Returning a Pointer from a Function

Example

 

Potential Pointer Pitfalls

 

Pointer Parameters vs. Reference Parameters