pseudo code example :
main()
{
//Original value of 'x' will remain unchanged
// in case of call-by-value
int x = 5;
print( "Value of x before call-by-value: " + x);
// 5
fun(x);
print("Value of x after call-by-value: " + x);
// 5 (in case of languages like JAVA which are pass by value)
}
void fun(int x)
{
x=x+10;
}
Now coming to the meaning - the value of x did not change in the main function - this is called pass by value.
If the value changes in the main function it is called pass by reference.
refer this for clear understanding between pass by value and pass by reference
What is Pass by Value?
In pass by value, the value of a function parameter is copied to another location of the memory. When accessing or modifying the variable within the function, it accesses only the copy. Thus, there is no effect on the original value.
What is Pass by Reference?
In pass by reference, the memory address is passed to that function. In other words, the function gets access to the actual variable.
Difference Between Pass by Value and Pass by Reference
Definition
Pass by value refers to a mechanism of copying the function parameter value to another variable while the pass by reference refers to a mechanism of passing the actual parameters to the function. Thus, this is the main difference between pass by value and pass by reference.
Changes
In pass by value, the changes made inside the function are not reflected in the original value. On the other hand, in pass by reference, the changes made inside the function are reflected in the original value. Hence, this is another difference between pass by value and pass by reference.
Actual Parameter
Moreover, pass by value makes a copy of the actual parameter. However, in pass by reference, the address of the actual parameter passes to the function.