User Defined Functions:
In
some situations, while designing complex programs, a user may require
performing some specific task repeatedly and there is no library function
available for performing the task. Hence to solve this problem, the programmer writes
his own function(s) as per requirements in the program. These functions which
are defined specifically by the user to meet his requirements are called
user-defined functions.
In
order to make use of a user-defined function, we need to establish three
elements that are related to functions.
1.
Function definition.
2.
Function call.
3.
Function declaration
The
function definition is an independent program module that is specially written
to implement the requirements of the function. In order to use this function we
need to invoke it at a required place in the program. This is known as the
function call. The program (or a function) that calls the function is referred
to as the calling program or calling function. The calling program should
declare any function (like declaration of a variable) that is to be used later
in the program. This is known as the function declaration or function
prototype.
Post a Comment