What is function in programming language

In programming world, function is a set of statement which use to perform particular task.
There are basically two type of function:

1. Built-in(library) function:-

                    System provided function which store in library called library function.


e.g. scanf(), printf(), strcpy(), strcmp().


2. User define function:-

                   Those function  which define by user to perform required task according to need called                          user define function.


*Parts of function:

1 declaration.
2 definition.
3 function call.

*Declaration is also known as prototype of function.
e.g.
 syntax:

      int addition (int,int);

where: int is a return type of function
             addition is a name of function
             int in parentheses is a argument pass by user

e.g. of user define function

int addition(int i,int j);
{

      int result;
      result = i+j;
      return result;
}




Comments