Function Parameters
1. Introduction
A function parameter (also called a formal parameter) is a variable listed in a function’s declaration or definition that receives a value when the function is called. The value passed during the call is known as an argument (or actual parameter).
Parameters allow functions to operate on different data each time they are invoked, making code reusable and modular. They define the interface between the caller and the function: the caller provides arguments, and the function uses its parameters to process them.
A parameter is the variable in the function signature; an argument is the concrete value passed by the caller.
Example – In def add(a, b): ... and add(3, 5), a and b are parameters, while 3 and 5 are arguments.
2. Basics: Syntax, Examples, and Explanation
2.1 In Python
In Python, parameters are declared inside the parentheses of a function definition. Python is dynamically typed, so parameter types are not specified explicitly (though type hints can optionally be used). Arguments are passed by object reference (often described as “pass by assignment”): the function receives a reference to the object; mutable objects can be modified inside the function, but reassigning the parameter does not affect the caller’s variable.
Syntax:
# function definition
def function_name(parameter1, parameter2, ...):
# function body
Example:
# function definition
def add(a, b):
# function body
return a+b
c = add(3, 4)
print(c) # output: 7
This function takes two numbers, a and b, and returns their sum.
Video Explanation

2.2 In C
C is a statically typed language. Every parameter must have an explicit type. Arguments are passed by value: the function receives a copy of the argument. Changes to the parameter inside the function do not affect the original argument. To modify the caller’s variable, a pointer to it must be passed.
Syntax:
// function definition
return_type function_name(datatype1 parameter1, datatype2 parameter2, ...){
// function body
}
Example:
#include<stdio.h>
// function definition
int add(int a, int b){
// function body
return a+b;
}
int main(){
int a = 3, b = 4, c;
c = add(a, b);
printf("%d\n", c);
return 0; // output: 7
}
Video Explanation
