Lab 8: Prelab Questions


Written Questions

Question #1: A(n) ____________ parameter receives a copy of the corresponding argument; a(n) ____________ parameter receives a reference to the corresponding argument.

Question #2: An ampersand & is used to designate a(n) ____________ parameter.

Question #3: The ____________ of a particular variable is the section of code where that variable is defined.

Question #4: ____________ scope is limited by the curly braces of a compound statement.

Question #5: ____________ scope extends all the way to the end of the source file.

Programming Exercises

Code #1: Write a prototype for the function evaluate() that has a return type of void, an int value parameter worth, and an int reference parameter refersTo.

Code #2: Write a function stub for the function evaluate() as described in the previous question.

Code #3: Write a declaration for a string variable named something as a local variable and some code containing this declaration in which it is a local variable.

Code #4: Write a declaration for a string variable named company as a global variable and some code containing this declaration in which it is a global variable.

Code #5: Write a declaration for a string variable named int. Why won't the C++ compiler like this?


Lab Exercise
Report errors to Larry Nyhoff (nyhl@cs.calvin.edu)