Difference between Actual arguments and Formal arguments
Actual arguments
1. The arguments that are passed in a function call are called actual arguments.
2. These arguments are defined in calling function.
3. At the time of the call, each actual parameter is assigned to the corresponding formal parameter in the function definition.
4. Example :
void main ()
{
int num1;
display(num1);
}
void display(int para1)
{
-------
--------
}
num1 is actual parameter
Formal Arguments
1. Formal parameters are written in the function prototype and function header of the definition.
2.The formal arguments are defined in function declaration.
3. Formal Parameters are local variables which are assigned values from the arguments when the function is called.
4. Example :
void main()
{
int num1;
int num1;
display(num1);
}
void display(int para1)
{
------------
-----------
}
para 1 is formal parameter
No comments:
Post a Comment