A function in C is a self-contained block of code that performs a specific task. Functions help divide a large program into smaller, manageable modules, making the program easier to understand, debug, and maintain.
Each function has a name, may accept input values called parameters, and may return a result.

Functions in C are broadly classified into two types:
Library functions are predefined functions provided by C, such as printf() and scanf().
User-defined functions are created by programmers to perform specific operations.
Function declaration informs the compiler about the function name, return type, and parameters before the function is used. It is also known as a function prototype.
return_type function_name(parameter_list);
Example:
int add(int a, int b);
Function declaration helps the compiler perform type checking.
Function definition contains the actual body of the function where the required operations are performed.
int add(int a, int b)
{
return a + b;
}
It specifies how the function works when it is called.
A function call is used to invoke a function and execute its code. Control is transferred to the called function, and after execution, control returns to the calling function.
sum = add(10, 20);
The values passed during the function call are called arguments.
The return statement is used to send a value back to the calling function.
It also terminates the execution of the function.
return result;
A function that does not return a value uses the return type void.
In call by value, copies of the actual arguments are passed to the function. Any changes made to the parameters inside the function do not affect the original variables.
void change(int x)
{
x = 50;
}
Call by value ensures data safety but does not allow modification of original values.
#include <stdio.h>
int add(int a, int b);
int main()
{
int sum;
sum = add(10, 20);
printf("Sum = %d", sum);
return 0;
}
int add(int a, int b)
{
return a + b;
}
This program demonstrates function declaration, definition, function call, and return value in C.