C Language



Admission Enquiry Form

  

Function with no Arguments and no Return



Function with no argument and with no return value in C

Function with no argument and with no return means when calling function is not giving any value to called function as an argument and called function is not returning any value to calling function.

Example:

#include<stdio.h>
#include<conio.h>
void main()
{
void sum(); //declaration of function
printf("\nCalling sum function");
sum();//calling of sum function
printf("\nCalling sum() again");
sum();// calling of sum()
printf("\nBye");
getch();
}//end of main
void sum() //body of fun
{
int num1,num2,res;
printf("\nEnter first number");
scanf("%d",&num1);
printf("\nEnter second number");
scanf("%d",&num2);
res=num1+num2;
printf("\nResult is %d",res);
}


Output

Calling sum function
Enter first number10

Enter second number20

Result is 30
Calling sum() again
Enter first number100

Enter second number200

Result is 300
Bye