Chapter 6

Created by Tatiyana Tongbua

modular programming
breaking program into set of manageable sized functions

1/36

TermDefinition
modular programming
breaking program into set of manageable sized functions
function definition
includes statements that make up the function
function can have zero to many parameters and either 0 or one return values
TRUE
function header
-name of function, data type of parameter, identifier name, data type of return value
function prototype
-name of function, data type for each parameter, data type for return -NOT necessary: identified name for parameter
function call
-name of function, identified name/constant for each argument
void
returns no value
local variable
define inside body of function, not accessible outside
static local variable
value is retained between function calls
when a function needs to use copy of argument, the argument should be passed by value
TRUE
reference variable
when used as a parameter --> allows function to access and modify original argument
function can have some parameters with default arguments and some without
TRUE
two are more functions may have the same name if ____
their parameter lists are different
overloaded function
more than one function has the same name
return statement
causes function to end and flow of control to move back to point of call
bool function
returns true or false
exit()
causes entire program to terminate
driver
program module, purpose is to test other modules by calling them
funcation call
statement that causes a function to execute
if no return statement, flow of control moves to next function
FALSE
definition
argument - information that is passed to function parameter - special variable that receives/holds that info
function can have
zero to many parameters, zero or one return value
function call, order of arguments doesn't matter
FALSE
copy of argument is passed
passed by value
when function needs access to original argument (ex to change its value)
argument needs to be passed into a reference parameter
function prototype
eliminates needs to place the function definition before call
global variable
declared outside all functions
cout << sqrt(22.0);
22.0 is an argument
both function headers and calls must list data types
FALSE
default argument
automatically passed to parameter when argument is left out of function call
global and local variables initialized to zero by default
FALSE
static local variable
value is retained between calls
can use exit() to return flow of control back to main()
FALSE
stub
dummy function that is called instead of the actual function it represents, tests call and return function; tests if working correctly
pass by value
term image
-copy of the argument -og isn't affected -void f(int x)
pass by reference
term image
-alias to og variable -affect the og -void f(int& x)