1.) Function Definition:
A function definition contains the actual body of the function — the block of code that performs the task.
Syntax:
return_type function_name(parameter_list) {
// function body
}Example:
int add(int a, int b) {
return a + b;
}- This defines what the function add actually does — it returns the sum of two integers.
2.) Function Prototype:
A function prototype is a declaration of a function that tells the compiler about the function’s name, return type, and parameters before its actual definition appears in the program.
Syntax:
return_type function_name(parameter_list);Example:
int add(int a, int b); // Function prototype- This tells the compiler that there is a function named add which takes two integers as arguments and returns an integer.
3.) Function Call:
A function call is the statement that actually invokes the function. When a function is called, the program execution control transfers to the function’s body.
Syntax:
function_name(arguments);Example:
int result = add(5, 3); // Function call- This calls the add function with 5 and 3 as arguments, and stores the returned value in result.
