10- void-functions, predicates, call-by-reference Flashcards
Void function
does not return a value, can only be used as a standalone statement
void
specified as return type
Predicate
function whose return value is boolean
used to compute a binary decision
idiom: use a predicate as an expression in a looping or branching construct
Variable memory allocation
assigning memory location to a variable
Function frame
unit of memory allocation for function’s local variables
contains memory for (local variables), parameters, return value
all variables are allocated at once: frame is allocated as a unit
active frame – frame of currently executing function
inactive frame – others
Program (call) stack
means of memory allocation to local function variables during program execution
allocates function frames
last-in/first-out (LIFO) data structure
active frame – on top of the stack
two operations:
push – inserts the frame of invoked function, makes it active
pop – removes the frame of ending function, makes the frame below it active
call-by-reference
parameter passing discipline that allows the function to modify the arguments