C Function Arguments & No Return Value
Function with arguments and no Return Value :
Note :
- Function accepts argument but it does not return a value back to the calling Program .
- It is Single ( One-way) Type Communication
- Generally Output is printed in the Called function
- Here area is called function and main is calling function.
Program :
#include<stdio.h> #include<conio.h> //---------------------------------------- void area(float rad); // Prototype Declaration //---------------------------------------- void main() { float rad; printf("nEnter the radius : "); scanf("%f",&rad); area(rad); getch(); } //---------------------------------------- void area(float rad) { float ar; ar = 3.14 * rad * rad ; printf("Area of Circle = %f",ar); }
Output :
Enter the radius : 3 Area of Circle = 28.260000