Static functions in C language basically limit the scope of methods to corresponding files.
You can also call these functions without initializing the object.
Syntax:
refer to:lautturi.comstatic Return_Type method_name(parameters)
{
body;
}
example:
#include <stdio.h>
//static function definition
static int sum(int a, int b){
return (a+b);
}
int main()
{
int number1,number2;;
printf("Enter the number1: ");
scanf("%d",&number1);
printf("Enter the number2: ");
scanf("%d",&number2);
printf("Addition of two numbers = ");
int res = sum(number1,number2);
printf("%d",res);
return 0;
}
output:
Enter the number1: 10 Enter the number2: 20 Addition of two numbers = 30