Syntax of function
Declaration section
<<Returntype>> funname(parameter list);
Definition section
<<Returntype>> funname(parameter list)
{
body of the function
}
Function Call
Funname(parameter);
<<Returntype>> funname(parameter list);
Definition section
<<Returntype>> funname(parameter list)
{
body of the function
}
Function Call
Funname(parameter);
Example function
#include<stdio.h>
void fun(int a); //declaration
int
main()
{
fun(10); //Call
}
void fun(int x) //definition
{
printf(“%d”,x);
}
Actual and Formal
parameters
Actual parameters are those that are used during a function call
Formal parameters are those that are used in function definition and function declaration
Formal parameters are those that are used in function definition and function declaration