click below
click below
Normal Size Small Size show me how
User-Defined Functio
Question | Answer |
---|---|
___ enable you to divide a program into manageable tasks | Functions |
The C++ system provides the ___ (predefined) functions | Standard |
To use a standard function, you must: -Know the ___ of the header file that contains the function’s specification, -___ that header file in the program and -Know the name and type of the function and ___ and ___ of the parameters (arguments) | Name, include, number, types |
There are two types of user-defined functions: ___ functions and ___ functions | Value- returning, void |
Variables defined in a function heading are called formal ___ | Parameters |
In a function call, the number of actual parameters and their types must ___ with the formal parameters in the order given | Match |
To call a function, use its name together with the parameter list | |
The general syntax of a ___ function is: functionType functionName(formal parameter list) { statements } | User-defined |
The line functionType functionName(formal parameter list) is called the function ___ (or function header). Statements enclosed between braces ({ and }) are called the ___ of the function. | Heading body |
If a function has no parameters, you still need the empty ___ in both the function heading and the function call | Parentheses |
A value-returning function returns its value via the ___ statement | Return |
A function can have ___ one return statement. However, whenever a return statement executes in a function, the remaining statements are skipped and the function exits | More than |
A return statement returns only ___ value | One |
A function ___ announces the function type, as well as the type and number of parameters, used in the function | Prototype |
When you use function prototypes, user-defined functions can appear in ___ in the program | Any order |
When the program executes, the execution always begins with the ___ statement in the function main | First |
User-defined functions execute only when they are | Called |
A call to a function transfers control from the ___ to the called function | Caller |
In a function call statement, you specify only the actual parameters, not their ___ or the function type | Data type |
When a function ___, the control goes back to the caller | Exits |
A return statement without any value can be used in a ___ function | Void |
If a return statement is used in a void function, it is typically used to exit the function ___ | Early |
The heading of a void function starts with the word ___ | Void |
A void function ___ have parameters | May or may not |
There are two types of formal parameters: ___ parameters and ___ parameters | Value reference |
A reference parameter receives the address (memory location) of its corresponding actual parameter | |
The corresponding actual parameter of a value parameter is an ___, a ___, or a ___ value | Expression Variable Constant |
A ___ value cannot be passed to a reference parameter | Constant |
When you include & after the data type of a formal parameter, the formal parameter becomes a ___ parameter | Reference |