Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

Share this Page URL

Chapter 7: Pointers and Parameters > Function Parameters - Pg. 131

CHAPTER 7: Pointers and Parameters 131 Without the * operator, the computer would place the value 27 in the memory allocated to myPointer . The * operator dereferences myPointer . Dereferencing a pointer turns the pointer into the variable it points to. Figure 7-7 shows the end results. 1,073,741,823 1,073,741,822 32,107 32,106 32,105 32,104 839 838 837 836 1 0 Figure 77. Finally, the value 27 is assigned to *myPointer. 8 3 int *myPointer; 6 int myVar; 2 7 If the concept of pointers seems alien to you, don't worry. You are not alone. Programming with pointers is one of the most difficult topics you'll ever take on. Just keep reading, and make sure you follow each of the examples line by line. By the end of the chapter, you'll be a pointer expert! Function Parameters One of the most important uses of pointers (and perhaps the easiest to understand) lies in the implementation of function parameters. In this section, we'll focus on parameters and, at the same time, have a chance to check out pointers in action.