Function


A function is a block of code that performs a specific task,with the help of function we can dividing complex or large programe into small components makes program easy to understand and we can find error.
A large program can be divided into different part called modules . Where each module does a specific task so each module is called a function.

Types of function:-

1) Library function or pre-defined function.
2) User-defined function.

Library function or pre-defined function

C library that comes with C compiler has a collection of various functions which perform standard and per-defined tasks. these functions written by designers of C compilers are called library functions.
     Example:-  pow(x,y);  printf();  scanf();  getch();  clrscr()……..

User-defined function

The functions written by the programmer or user to do the specific tasks are called user defined function or programmer defined function.

Elements of user-defined function.


Function Definition

The program module that is written to achieve a specific task is called function definition.
Each function definition contain two parts:-

Function call

Once the function is defined it has to be called so as to achieve the task this method of calling a function to achieve a specified task is called function call.