A function is called by the calling program using the function name with the required number of arguments in parentheses. The function call appears in an assignment statement or in an output statement.
The arguments listed in the function calling statement are referred to as actual arguments. They are the actual values passed to a function to compute a value or to perform a task. Consider a function call statement with actual arguments as given below.
ncr = fact(n)/(fact(n-r)*fact(r));
The arguments used in the function declaration are referred as formal arguments. They are simply formal variables that accept or receive the values supplied by the calling program. Consider a function call statement with formal arguments as given below.
int fact(int k)
int i, p = 1;
for(i = 1; i <= k; i++)
p = p * i;
Note : That the number of actual and formal arguments and their data types should match.
A function calling itself again and again to computer a value is referred to recursive function or recursion. Normally a function is called by the main program or by some other function but in recursion the same function is called by itself repeatedly.
Recursive function are written with less number of statements compared functions. Recursive is effective where terms are generated successively to computer a value. Recursive is useful for branching processes. Recursion helps to create to create short code that would otherwise be impossible.
We adding new programming language tutorials very soon.
We make a Collaboration with HackIsOn YouTube Channel So, Please Subscribe Their Channel and keep supporting