Computer Science Chapter 6
Passed by Value
When only a copy of an argument is passed to a function
Exit Function
When the exit function is called it causes the program to stop regardless of which function contains the call
Code Reuse
Writing the code to perform a task once, then reusing it each time you need to perform a task
Overload
You may assign the same name to multiple functions, as long as their parameter lists are different
Name
You should give each function a descriptive name. In general, the same rules apply to variables names also apply to function names
Function
A collection of statements that perform a specific task
Stub
A dummy function that is called instead of the actual function it represents
Return Type
A function can send a value to part of the program that executed it. The data of the value that is sent from the function
Called
A function is executed when it is called, when a function is called the program branches to that function and executes the statement in its body
Global Constant
A named constant that is available to every function in a program
Modular
A program that is broken up into functions that perform specific tasks
Driver
A program that tests a function by simply calling it
Parameters
Allow you to design your own function that accepts data
Reference Variable
An alias for another variable, any changes made to the reference variable are actually performed on the variable for which it is an alias
Function Prototypes
Eliminates the need to place a function definition before all calls to the function
Lifetime of Local Variable
Function's of local variables exist only while the function is executing
Void Functions
Functions that perform one or more statements and then terminate
Value-Returning Functions
Functions that return a value
Shadow Variable
Global Variables or constant's name is hidden by the name of the local or parameter variable
Default Arguments
Passed to the parameter when the actual argument is left out of the function call
Function Definition Contains
Return type, Name, Parameter list, Body
Body
The body of a function is the set of statements that perform the function's operation. They are enclosed in a set of braces
Function Signature
The name of the function and the data types of the function's parameters in the proper order
Arguments
Values sent into a function
Local Variables
Variables that are defined inside a functions
Passed by Reference
When a reference parameter is used it is said that the argument is