Functional Programming-Call by Value
After defining the function, there is a need to pass the arguments into the function to get the desired output. All the programming language supports the call by value and call by reference methods after arguments passed into the functions.
"Call by value" works only on the object-oriented programming language like C++. Functional programming language like Python also supports "call by value".
The original value of the call by value method will not change when we pass the arguments to the function. The function will store the value locally through the function parameter in stack's memory. The changed value in the function will not affect functions from the outside.
Call by Value in C++
Here is the program which shows the call by value in the C++.
This will show the following output:
Value of x is: 200 Value of y is: 100
Call by Value in Python
Below program shows the working of Call by Value in Python:
The output of the above program will look like as shown below: