< Previous | Contents | Next >

Passing Pointers

Even though references are the preferred way to pass arguments because of their cleaner syntax, you still might need to pass objects through pointers. For example, suppose youre using a graphics engine that returns a pointer to a 3D object. If you want another function to use this object, youll probably want to pass the pointer to the object for efficiency. Therefore, its important to know how to pass pointers as well as references.


 

Introducing the Swap Pointer Version ProgramPassing by ValuePassing a Constant Pointer