CS 150 Introduction to C++ Programming - Spring 1998 

[ Home | Lecture Notes| WebTutor | WebTutor Site Map]


Calling Functions


When one function "calls" another function, they can communicate information back and forth. A function heading and a function prototype will contain a list of its parameters enclosed in parentheses. Parameters are variables which can contain a value to be passed between the calling and called functions. The actual values passed between functions are called arguments. Arguments are given in the function call statement when the calling program actually uses the function. Arguments and parameters are "matched" at the time of a function call by using the order in which each is specified. The first argument is assigned to the first parameter, and so forth. One can think of this passing of arguments to parameters as an assignment statement, "parameter1 = argument1" and so forth.

Given the following program, show the Output after each function call.

  1. First call to 'Print'

  2. Second call to 'Print'

  3. Third call to 'Print'

 

Choose one when done