What is actual parameter and formal parameter in c language with example?
Answers
Answered by
0
these can be found only in program with function
in the function call the variables used is called actual parameters. These variables are in the main function .
In the function definition the variables used are called formal parameters they receive the value of the called variable and stores it in it.
eg:
#include <upstream.h>
void sum( int , int )
void main()
{
int x, y;
cout<< "ENTER TWO NO."
cin>>x>>y;
sum(x,y)
}
void sum( int a , int b)
{
cout<<(a+b);
}
HERE
x and y are actual parameters
AND
a and b are formal parameters
in the function call the variables used is called actual parameters. These variables are in the main function .
In the function definition the variables used are called formal parameters they receive the value of the called variable and stores it in it.
eg:
#include <upstream.h>
void sum( int , int )
void main()
{
int x, y;
cout<< "ENTER TWO NO."
cin>>x>>y;
sum(x,y)
}
void sum( int a , int b)
{
cout<<(a+b);
}
HERE
x and y are actual parameters
AND
a and b are formal parameters
Similar questions
Social Sciences,
8 months ago
Physics,
8 months ago
English,
8 months ago
Math,
1 year ago
Science,
1 year ago