Function and Recursion
Function And
Recursion
Function Construction
Return-value-type
function-name( parameter-list)
{
statements;
}
return-value-type : data type of the value returned
{
statements;
}
return-value-type : data type of the value returned
·
If not filled, it will be integer
·
if return-value-type is void then the function
will not return value
parameter-list
: list of value sent from the function initiator (user)
Recursive
Definition : is a function call inside a certain function
calling itself.
Have 2 components:
1.
Base case:
return value(constant) without calling next recursive call.
return value(constant) without calling next recursive call.
2.
Reduction step:
Sequence of input value converging to the
base case.

Komentar
Posting Komentar