For return the integer value from the function we need to make the return type as a int.
Syntax-
int function_name()
{
return value;
}
Example-
int f()
{
return 1;
}
// no error
void f()
{
return 1;
}
// Give an error
program-
#include< stdio.h>
int function() //definition
{
printf("You make the function\n");
return 1;
}
int main()
{
int a;
printf("Inside main function\n");
a=function(); //calling
printf("%d",a);
return 0;
}
Inside main function
You make the function
1