group of statements
that are grouped together to perform certain task. Once after defining the function,it has to be called to execute. Function can be called as "mini-program"
, because a function is written once and can be used as many times as needed in a program. A function can be called with the function name.
Function executes only when it is called but cannot be executed automatically during page buffering.
The user-defined functions can be accessed by using the following terms:
Function declaration is also called as “function prototype”.
To be a prototype, function declaration need to have arguments.Although functions that return int values need not use prototype, but it is recommended.Function Body is not the part of function declaration.It is involved in function definition.
In the above syntax,
return_type : returns the data type of the function value.
function_name : This is function’s actual name.
argument_list : The argument list refers to the order,type and number of the parameters of a function.
Eg: int add(int a,int b)
In the above syntax, the body of the function has a group of statements that defines the functionality of function does.
There are two ways to pass the arguments while calling a function from a program.They are :