Parameters are used to send data into a function. Of course, the first actual parameter gets matched with the first formal parameter, the second actual parameter with the second formal parameter, etc. Reference parameters are used to send data back out of a function. Values can also be sent into the function via a reference parameter. The key idea is that any change made by the function to such a parameter is sent back out of the function.
Data can also be send back out of a function in the function name itself.
This is accomplished by using a return statement inside the code for the function. Let's look at an example program, fn.cpp , that illustrates many of these features. Read through the code and try to identify the ways that data is sent into and back out of the functions. The Run-Time Stack Program execution begins at the start of the main function, of course. The main function in this program has variables Length , Width , Area , and Perim .