C Formal Vs Actual Parameters



What is Parameter ?

  • In C Programming Function Passing Parameter is Optional.
  • We can Call Function Without Passing Parameter .

Function With Parameter :

add(a,b);
  1. Here Function add() is Called and 2 Parameters are Passed to Function.
  2. a,b are two Parameters.

Function Call Without Passing Parameter :

Display();

What is Actual Definition of Parameter ?

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 :

  1. Parameter Means Values Supplied to Function so that Function can Utilize These Values.
  2. Parameters are Simply Variables.
  3. Difference between Normal Variable and Parameter is that “These Arguments are Defined at the time of Calling Function“.
  4. Syntactically We can pass any number of parameter to function.
  5. Parameters are Specified Within Pair of Parenthesis .
  6. 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 :
  • Parameter Written In Function Definition is Called “Formal Parameter”.
void main()
{
int num1;
display(num1);
}

void display(int para1)
{
-----------
-----------
}
  • Para1 is “Formal Parameter

Actual Parameter :
  • Parameter Written In Function Call is Called “Actual Parameter”.
void main()
{
int num1;
display(num1);
}

void display(int para1)
{
-----------
-----------
}
  • num1 is “Actual Parameter