Actual arguments (or) Actual Parameters
The arguments that are passed in a function call are called actual arguments. These arguments are defined in the calling function.
Formal arguments (or) Formal Parameters
/* Demonstrating the actual and formal arguments */
#include <stdio.h>
int add(int, int); /* Function Prototype */
int main()
{
int a = 10, b= 20, sum;
/* a and b are actual arguments. They are the source
of data. Caller program supplies the data to called
function in form of actual arguments. */
sum = add(a,b); /* function call */
printf("Sum of %d and %d is: %d \n", a, b, sum);
}
/* a and b are formal parameters. They receive the values from
actual arguments when this function is called. */
int add(int a, int b)
{
return a + b;
}
OUTPUT:
Sum of 10 and 20 is: 30
No comments:
Post a Comment