A function is a self-contained block of statements that perform a coherent task of some kind.
The function in C language is also known as procedures or subroutines in other languages.
To perform any task we can create a function.A function can be called many times.
Functions provide code modularity and reusability.
Declaration of a Function:
return_type function_name(data_type_parameters)
{
//code to be executed;
}
Return value:
A C function may or may not return a value from the function.
Example with return value:
int get()
{
return 10;
}
Example without return value:
void hello()
{
printf(”hello”);
}
If you don't have to return any value from the function,use void as the return type.