## Category of User Define Function

There are four categories of User Define Function
(1) Function with No Arguments and No Return value
In this category function does not accept any arguments and does not return any value.

Syntax
void FunctionName(void);
Consider an example of finding sum of two number
#include<stdio.h>
#include<conio.h>
void main()
{
void sum(void); // Function Declaration
clrscr();
sum(); // Function Call
}
//Function Definition
void sum(void)
{
int a,b,c;
printf("Enter Two Numbers:");
scanf("%d%d",&a,&b);
c=a+b;
printf("Sum=%d",c);
}

(2) Function with Arguments but No Return value
In this category function accepts arguments but does not return any value.

Syntax
void FunctionName(ArgumentList);
Consider an example of finding sum of two number
#include<stdio.h>
#include<conio.h>
void main()
{
void sum(int a, int b); // Function Declaration

int a,b;
clrscr();
printf("Enter Two Numbers:");
scanf("%d%d",&a,&b);
sum(); // Function Call
}
//Function Definition
void sum(int a, int b)
{
int c;
c=a+b;
printf("Sum=%d",c);
}

(3) Function with No Arguments but with Return value
In this category function does not accepts arguments but it return value.

Syntax
ReturnType FunctionName(void);
Consider an example of finding sum of two number
#include<stdio.h>
#include<conio.h>
void main()
{
int sum(void); // Function Declaration

int c;
clrscr();
c=sum(); // Function Call

printf("Sum=%d",c);
}
//Function Definition
int  sum(void)
{
int a,b,c;
printf("Enter Two Numbers:");
scanf("%d%d",&a,&b);
c=a+b;
return c;
}

(4) Function with arguments and return value
In this category function accepts arguments and also return value.

Syntax
ReturnType FunctionName(ArgumentList);
Consider an example of finding sum of two number
#include<stdio.h>
#include<conio.h>
void main()
{
int sum(int a, int b); // Function Declaration

int a,b,c;
clrscr();
printf("Enter Two Numbers:");
scanf("%d%d",&a,&b);
c=sum(a,b); // Function Call

printf("Sum=%d",c);
}
//Function Definition
int  sum(int a, int b)
{
int c;
c=a+b;
return c;
}