Function with no arguments and with return value - C Programming
C Program to multiply three numbers using function.
/* Multiplication of three numbers */
#include <stdio.h>
#include <conio.h>
void main()
{
int *mul(), *s; /* Local definitions */
/* Statements */
clrscr();
s=mul(); /* function call */
printf("Multiplication of three numbers is = %d",*s);
getch();
} /* main */
*mul()
{
int a,b,c,i;
printf("\n Enter the three values: ");
scanf("%d %d %d",&a,&b, &c);
i=a*b*c;
return(&i);
} /* mul */
OUTPUT
Enter the three values: 4 8 2
Multiplication of three numbers is = 64
EXPLANATION: The function* mul() is declared as a pointer function i.e., the function declared as pointer always returns the reference. The reference returned by the function *mul() is assigned to a pointer *s The pointer *s prints the multiplication value.
Computer Programming C Laboratory: Functions C Programs : Tag: C Programming : - C Program to multiply three numbers using function (Function with no arguments and with return value)