C Programming
Call by value
When we use call by value machanism a carbon copy of argument will be passed in the called function and store in the seperate memory allocation. Hence if we change the value of variable in called function will not effect the original value in calling function.
Ex.
void show(int,int);
void main()
{
int a,b;
printf("Enter two no.");
scanf("%d%d",&a,&b);
printf("Before calling:-%d%d",a,b);
show(a,b);
printf("After Calling:-%d%d",a,b);
}
void show(int a,intb)
{
printf("In called function:-\n");
a=a+5;
b=b+10;
printf("Modified value=%d%d",a,b);
}
Output:-
Enter two no 10 20
Before calling:-10 20
In called function
Modified value=15 30
After calling:-10 20