Previous: Chapter 6
Up: Table of Contents
Previous Page: Chapter 6
Next Page: 6.1 What is a Pointer?

6 Pointers

In the preceding chapters, our programs have been written to access objects directly, i.e. using the variable names. We have postponed until now a discussion of the concept of indirect access, i.e. access of objects using their address. As we have seen, variables local to a function may be accessed using their name only within that function. When arguments are passed to another function, only the values are passed, and the called function may use these values, but cannot affect the variable cells in the calling function. Sometimes, however, a function needs to have direct access to the cells in another function. This can be done in C through indirect access, using the address of the cell, called a pointer.

In this chapter, we will introduce the concepts of indirect access, pointer types, and dereferenced pointer variables. We will use these concepts to write functions that indirectly access objects in a calling function.


tep@wiliki.eng.hawaii.edu
Wed Aug 17 08:45:54 HST 1994