Chapter 6 Flashcards Preview

Programming Fundamentals > Chapter 6 > Flashcards

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

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

return type, name, parameter list, and body

2

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

return type

3

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

name

4

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

parameter list

5

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

body

6

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

function header

7

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

void function

8

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

9

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

function prototype

10

values sent into a function; aka actual

arguments

11

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

parameter

12

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

passed by value

13

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

return statement

14

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

15

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

16

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

17

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

18

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

19

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

20

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

21

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

EXIT_FAILURE

22

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

EXIT_SUCCESS

23

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

stub

24

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

driver