CSCI 240 - Function Worksheet 1

Basics

Answer questions about the 3 function prototypes below.

long int Factorial(int );

double FindAverage(double , int );

void PrintTitle(string , int , int );

1. What type of value will each function return?

2. How many arguments does each function expect?

3. Write a calling statement for each function using constant values as arguments. (Use values like 1, 2, 3.5, "Mary", not num1, name etc.)

NOTE that Factorial and FindAverage are assignment statements because they return a value. If they are not called with an assignment statement the returned value is lost. PrintTitle does not need an assignment. It does its job and returns.

4. Write a calling statement for each function using variables as arguments.

The following variables would be declared in the calling function, not the function being called.

	int	num1, column, row, count;
	double  sum;
	string  name;

NOTE: When you call a function you do not need to know the variable names that the function uses for the arguments.