PREDEFINED AND USER-DEFINED FUNCTIONS Flashcards
(73 cards)
these are like building blocks
functions
they allow complicated programs to be divided into manageable piecesq
functions
4 advantages of functions
- a programmer can focus on just that part of the program and construct it, debug it, and perfect it
- different people can work on different functions simultaneously
- can be reused (even in different programs)
- enhance program readability
functions are also called as these
modules
functions are like _________________
miniature programs
these can be put together to form a larger program
functions
in algebra, a function is defined as a rule or correspondence between values, called the function’s __________
arguments
predefined functions are organized into separate ______________
libraries
i/o functions are in the _________ header, whereas math functions are in the __________ header
iostream, cmath
these functions have a return type
value-returning functions
they return a value of a specific data type using the return statement
value-returning functions
value-returning functions return a value of a specific data type using the _______ statement
return
these functions do not have a return type; they do not use a return statement to return a value
void functions
to use value-returning functions, you must ________________________________
include the appropriate header file in your program using the include statement
to use value -returning functions, you must know the following items:
- name of the function
- number of parameters, if any
- data type of each parameter
- data type of the value returned (called the type of the function)
TRUE OR FALSE: the value returned by a value-returning function is unique
true
a value-returning function is used in an _________ or in an __________
assignment, output statement
the first 4 properties of a value-returning function
heading
what type of function is this:
int abs(int number);
variable declared in the heading of a value-returning function
formal parameter
identify the formal parameter in this example:
int abs(int num)
num
variable or expression listed in a call to a value-returning function
actual parameter
in value-returning functions, the function type can also be called as these
data type or return type
syntax for a value-returning function
functionType functionName (formal parameters)
{
statements
}