Tuesday 7 December 2010

Function with no arguments and return value


Functions with no Arguments and Return value

The called Function does not recieve any data from the calling Function. It is also a one-way data communication between the calling Function and the called Function. So let us understand this with the help of Program:


#include<stdio.h>
#include<conio.h>
void main()
{
float sum;
float total();
clrscr();
sum = total();
printf(" Sum = %f\n" , sum);
getch();
}

float total()
{
float a, b;
a = 5.0 ;
b = 15.0 ;
return(a+b);
}

Output:
Sum = 20.000000

Category of Functions
Functions


No comments:

Post a Comment