CISC 1600 Lecture Notes - Lecture 18: Polskie Radio Program I, Function Prototype
41 views5 pages
12 Mar 2017
School
Department
Course
Professor
Document Summary
Passing data to parameters by value : a copy of the actual parameter is placed in the memory location of its corresponding formal parameter. Pass by reference : both the main function and function called refer to the same memory location (share the same value). Argument passed to reference parameter must be a variable (cannot be an expression or constant) Use only when appropriate, try to stay away from using it. When a copy of an argument cannot reasonably or correctly be made, such as when the argument is an array or a file stream object. If a value must be sent back to the calling function (or can use a return statement instead) When two or more variables passed as arguments to a function need to have their values changed by that function. Ex) void calpaycheck(float rate, int time, float& gross) // 3 parameters.