A ____ is a named, independent section of C code that performs a specific task and optionally returns a value to the calling statement.
function
By using that identifier in another part of the program, you can execute the statements contained in the function. This is known as _____.
calling the function
A function is ____. A function can perform its task without interference from or interfering with other parts of the program
independent
A function ______. A task is a discrete job that your program must perform as part of its overall operation, like sending a line of text to a printer.
performs a specific task
A function can _____. When your statement calls a function, the statements a function contains are executed. If you want them to, these statements can pass information back to the calling program.
return a value to the calling statement
There are two types of functions in C Programming
Standard Library functions (built-in) User-defined functions (custom)
The _____ are built-in functions in C programming.
standard library functions
These functions are defined in header files.
standard library functions
The ____ and ____ functions are defined in the stdio.h header file.
printf() scanf()
The ____function is defined in the math.h header file.
sqrt()
LIST THE 5 REASONS WHY FUNCTION USED IN PROGRAMMING
Function code is reusable.
Functions make programs smaller.
Functions make programs easier to write.
Functions lead to improved commenting and readability.
Functions make programs easier to maintain
The first line of a function is called function ____
prototype declaration.
It tells the compiler four things about the function:
( list the four things about the function)
Its data type
Its name
The argument it takes
Who can call it
Like an operand and expression, a _____ also has a data type associated with it.
FUNCTIONS
The data type of a function is the data type of the value it ___.
returns
If the data type is omitted it defaults to_____
int.
Every function must have a_____. Following the rules of identifiers.
name
There can be only one function named ____in a program.
main
The expression following ____is evaluated and its value becomes the return value of the function.
return
The value passed by the function call statement is called an ____
argument.
The arguments passed into a function are known as the function’s _____
parameters.
when passing an argument in function, We passed the _____ not its name.
variable’s value
The C language provides a convenient mechanism whereby the results of a function may be returned to the calling routine.
RETURNING VALUES
The syntax of this (RETURNING VALUES) construct is:
return expression;
This statement indicates that the function is to return the value of the expression back to the calling function
RETURNING VALUES
There are two ways to pass parameters to functions:
They are known generically as “” and “_”.
call by value AND call by reference
In C, all arguments are passed “_______”. This means that each argument passed to a function is evaluated, and its value is passed into the function.
call by value
In a call by_____, instead of passing the value of the argument into the function, a reference to (i.e. the memory address of) the value is passed into the function.
reference
LIST THE DIFFERENT KINDS OF USER DEFINED FUNCTIONS BASED ON OUR NEEDS
Non-returning functions without parameters
Non-returning functions with parameters
Returning functions without parameters
Returning functions with parameters
NON-RETURNING FUNCTIONS WITHOUT PARAMETERS SYNTAX
NON-RETURNING FUNCTIONS WITH PARAMETERS SYNTAX
RETURNING FUNCTIONS WITHOUT PARAMETERS
RETURNING FUNCTIONS WITH PARAMETERS
An outer block variable name is valid in an inner block unless the block redefines
FUNCTION VARIABLES
If an existing variable name is redefined in an inner block, or a new variable name is defined in an inner block, the variable is valid only within that block and is “___” from an outer block.
hidden
the scope of a local variable is the function in which it is ___
defined.
variables that are declared within the bounds of a function or block are referred to as_____
local variables or internal variables..
Variables may also be declared outside of any function block, in the same source file. They are referred to as___
global variables or external variables.
By using recursion in returning functions, it is necessary to use ____ for different outcomes.
multiple return statements
An_____ is a group of memory locations related by the fact that they have the same identifier and data type.
array
____ provides the capability for the programmer to define a set of ordered data items. An array is just the same to a list.
C language
Array must be____ before they are used.
declared
▪ Giving a name to an array takes also the rules _____ in identifiers.
of naming convention
Declaration of an array involves ___the data type of values that will be stored (int, char, float, double) and ___ also the maximum number of elements (dimension) that will be stored.
declaringindicating
syntax of array
Each element of the array can be referenced by means of a number called the_____.
index or subscript
The index must be an____ or an ____
integer integer expression.
In C, the first element is indexed with____
0 (zero).
To access or reference a single element of an array, we state the array name followed by a number in ______.
square brackets
If an array uses an expression as a____, the value of the expression is evaluated first to determine the subscript.
subscript
An____ array element can be used just like variable.
individual
Array _____can also be used in calculations. They are also operands.
elements
Like variables, arrays can also be _____
initialized
This is done by listing the initial _____ of the array.
values (initializers)
The values in the list are separated by , and the entire list is enclosed by_.
commas parentheses
If there is not enough values, elements are set to___
0
C allows to define an array without ____the number of elements (no dimension).
specifying
When this is done the size of the array is determined____, based on the number of ____.
automatically initialized elements
C has no___to prevent the computer from referring to an element that does not exist.
array bounds checking
Storing individual values in each array element requires accessing ____array elements
individual
Size of array is usually passed to a____
function