Chapter 6 Flashcards Preview

Programming Fundamentals > Chapter 6 > Flashcards

Flashcards in Chapter 6 Deck (24)
Loading flashcards...

a function definition must include 1, 2, 3, 4

return type, name, parameter list, and body


fcn can send a value to part of program that executed it; is data type of value that's sent from fcn

return type


you give each fcn a descriptive __ (rules are same as for variables)



prgm can send data to a fcn; is a list of variables that holds values being passed to fcn

parameter list


set of statements that perform fcn's operation; enclosed in a set of braces



contains return type, fcn name, and parameter list; not terminated by semicolon

function header


fcn that doesn't return a value; simply performs statements

void function


name of fcn followed by a set of ()s and a semicolon; executes the fcn and is terminated by semicolon; return type is not listed; ()s are empty if data isn't being passed to fcn; may be used in control structures (loops, if statements, switch statements); after executing fcn, program returns to point of call

function call


looks sim to fcn header except there's a semicolon at the end; aka fcn declaration

function prototype


values sent into a function; aka actual



special variable that holds a value being passed into a fcn; aka formal



when a copy of an argument is passed to a fcn; fcn cannot change original argument

passed by value


causes fcn to immediately terminate and give control of program back to statement that called the function

return statement


fcn that returns a value back to statement that called it; can use this value any where you can use a regular value of same data type

value-returning fcn


named constant that is available to every function in a program; can't be changed during program's execution; typically used to represent unchanging values that are needed throughout a program

global constant


passed to parameter when actual argument is left out of function call, usually listed in fcn prototype; are literal values or constants with an = operator in front of them, appearing after the data types listed in a fcn prototype; are only used when argument is left out of a function call; must be defined last

default argument


allows access to original argument; any change made to the ___ variable are actually performed on variable for which it's an alias; can be used to allow a function to change a variable in another function; can only be done w/ variables

reference variable / passed by reference


when fcns have same name and dif parameter lists; convenient when there are sim functions that use a dif # of parameters or parameters of dif data types

overloaded functions


name of function and date types of fcn's parameter's in proper orderl used by C++ to distinguish it from other functions with the same name; does NOT include the fcn's return value

function signature


causes program to stop, regardless of which function contains the call; requires header file cstdlib; takes an integer arg (exit code you wish program to pass back to comp's OS and is smtms used outside of prgm to indicate whether program ended successfully or as result of failure

exit function


termination code that commonly represents an unsuccessful exit under current operating sys



termination code that commonly represents a successful exit under current operating system



dummy function that's called instead of actual function it represents; usually displays a test message acknowledging that it was called and nothing more; allows you to concentrate your testing efforts on parts of program that call the fcn; allows you to det whether program is calling a fcn when you expect it to, and to confirm that valid values are being passed to function and that the return value is being handled properly; when this debugged, move on



prgm that tests a fcn by simply calling it; if fcn accepts args, this passes test data; if has return value, displays the return value (allows you to see how fcn performs in isolation from the rest of the program it will eventually be part of); can be used to thoroughly test a program; when fcn performs as desired, it can placed into actual program it will be part of