Function in c with parameter and returning a value.

void main()
{
int a=1,b=5,c;
clrscr();
c=operation(a,b);
printf("%d",c);
getch();
}
int operation(int a,int b)
{
int c;
c=++a * ++a * b++;
return c;
}
Output: 45
Note. Any function can return only one value at a time. If return type is int then there is not necessity of function declaration.

No comments: