What happen exactly when we pass the value to function
I wrote to understand basic of pass by value
Code:
#include<stdio.h>
/* function declaration */
void pass(int x, int y);
void pass(int x, int y)
{
printf ( "\n x : %d", x);
printf ( "\n y : %d", y);
}
int main () {
/* local variable definition */
int a = 100;
int b = 200;
printf("Before pass, value of a : %d\n", a );
printf("Before pass, value of b : %d\n", b );
/* calling a function to pass the values */
pass(a, b);
printf("\n After pass, value of a : %d\n", a );
printf("\n After pass, value of b : %d\n", b );
return 0;
}
Before pass, value of a : 100
Before pass, value of b : 200
x : 100
y : 200
After pass, value of a : 100
After pass, value of b : 200
I am not sure but i think when we call function value of x and y will replace with a and b
we are passing value 100 and 200 to the function
Is it the whole process of pass by value ?