# Functions

## **Functions**

- A function is a subpart of a program which can be reused as and when required.

- Functions are the building blocks of programming.

- It is a named unit of a group of program statements. This unit can be invoked from other parts of program as when needed.

> function is divided into two parts ->

1.  Function Definition
2. Function Prototype 


## **Function Definition **

-  A Function must be defined before it is used anywhere in the program. The general form of function definition is given below :

data-type    function-name  ( parameters )
{
body of the function 
}

> Following code is a example of function definition ->

```
int add(int a , int b)
{
int sum;
sum=a+b;           //function definition 
return sum;
}
``` 

## **Function Prototype**

- A Function Prototype is a declaration of the function that tells the program about the type of the value returned by the function and the number and type of each argument.

- It does not have any return statement.

> Following code is a example of function definition ->

```
int add(int a, int b); // function declaration
``` 













