C Language



Admission Enquiry Form

  

Function with no Prototype in C



Function with no prototype in C

Function without prototype means when we do not declare the function and write the function body above the main function.Otherwise compiler will give prototype error of that function.

Example:

#include<stdio.h>
#include<conio.h>
void sum()   //body of function
{
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);
}//end of sum
void main()
{
printf("\nCalling sum fun");
sum();//calling
printf("\nBye");
getch();
}//end of main


Output

Calling sum fun
Enter first number10

Enter second number20

Result is 30
Bye