Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
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.
A function parameter is your chance to share a variable between a calling function and the called function.
Suppose you wanted to write a function called AddTwo() that took two numbers, added them together, and returned the sum of the two numbers. How would you get the two original numbers into AddTwo()? How would you get the sum of the two numbers back to the function that called AddTwo()?
As you might have guessed, the answer to both questions lies in the use of parameters. Before you can learn how to use parameters, however, you'll have to first understand the concept of scope.