Category of Functions:
We have some other type of Functions where arguments and return value may be present or absent. Such functions can be categorised into:
- Function with arguments but no return value.
- Function with no arguments and return value.
- Functions with no arguments and no return values
So Let's have a look on Category of Functions one by one:
1. Function with Arguments but no return value: Here the called Function recieves the data from the calling function but the called function does not return any value back to the calling Function.So, let us understand with the help of Program:
#include<stdio.h>
#include<conio.h>
void main()
{
int a, b;
printf(" Enter the value of a and b\n");
scanf("%d%d" , &a ,&b);
largest(a, b);
}
/* Function to compute largest */
largest(c, d)
int c, d;
{
if(c>d)
{
printf(" Largest = %d\n");
}
else /* (c<d) */
{
printf(" Largest = %d\n");
}
return();
}
Output:
Enter the values of a and b
20
15
Largest = 20
Function with no Arguments and Return Values |
Functions with no Arguments and no Return Values |
0 Response to "Detailed Discription of Category of Functions with Examples"
Post a Comment