Types Of Function

                                                             CATEGORY OF FUNCTION
1.Library function
2.Userdefined function

LIBRARY FUNCTION
It is also called predefined function or built-in or system define or fundamental or intrinsic function.This type of function is predefined by the system we cannot modify in this type of function.It has limited task.A user can only used the function but cannot change them.It means than user cannot understand the internal working of these function.

For example:

printf(),scanf(),clrscr(),getch() etc.

NOTE:
Whenever we use libray function in our program then the related header file must be included.

USER-DEFINED FUNCTION
The functions which are designed according to the requirement user are called User-defined function
.The user can modify this type of function there task is not limited.

In programming environment certain partof the logic need to create upper on function where return value is needed after performing the task.

Execution of every C programs always begin with main() function.Each function must be called in the main function.



EXAMPLES:
Write a program in c to input the two numbers and display their SUM by using function.


#include<stdio.h>
#include<conio.h>
int sum(int,int);
void main()
{     
                int a,b,c;
                 printf("Input two number");
                scanf("%d%d",&a, b);
                c=sum(a,b);
                printf("/n sum=%d",c) ;
                getch();
 }
                int sum(int x,int y)
{
                return(x+y);
 }






Comments

Post a Comment

Popular posts from this blog

Introduction of C Language

Constant in C

Computer generation