In call by value method values of the variables are send at the time of function call. It makes the copies of variables that are sent to the function because of which any changes made by the function are not reflected in the original variables.
Eg: Program of swapping values of two variables by using call by value method
Void swap (int c,int d)
{
Int temp;
temp=c;
c=d;
d=temp;
}
Void main()
{
int a=10, b=20;
swap(a,b);
printf (“Value of a is %d \n value of b is %d”,a, b);
getch();
}
Output:
Value of a is 10 value of b is 20