What is Function Parameter - Formal Vs Actual
Monday, August 16, 2024
What is Parameter ?
- In C Programming Function Passing Parameter is Optional.
- We can Call Function Without Passing Parameter .
add(a,b);
- Here Function add() is Called and 2 Parameters are Passed to Function.
- a,b are two Parameters.
What is Actual Definition of Parameter ?Display();
In computer programming, a parameter is a special kind of variable, used in a subroutine to refer to one of the pieces of data provided as input to the subroutine.These pieces of data are called arguments. [Definition From Wiki]Note :
- Parameter Means Values Supplied to Function so that Function can Utilize These Values.
- Parameters are Simply Variables.
- Difference between Normal Variable and Parameter is that "These Arguments are Defined at the time of Calling Function".
- Syntactically We can pass any number of parameter to function.
- Parameters are Specified Within Pair of Parenthesis .
- These Parameters are Separated by Comma (,)
Display(a,b,c,d,e);
- Parameter : The names given in the function definition are called Parameters.
- Argument : The values supplied in the function call are called Arguments.
Formal Parameter : |
void main() { int num1; display(num1); } void display(int para1) { ----------- ----------- }
|
Actual Parameter : |
void main() { int num1; display(num1); } void display(int para1) { ----------- ----------- }
|
0 comments:
Post a Comment