Pass By Value - Function
What is Function Calls?
How to pass by value in C++?
Pass by value
or Call by value is the method where a copy of the value of the variables are passed to the function to do specific operation to return the result. The actual values of the variable remains unchanged as changes are made to the copied values of the variables.
multiply(int a, int b)
r = a * b;
cout << "Enter the first integer::"; cin >> x;
cout << "Enter the second integer::"; cin >> y;
cout << "Product of X and Y is::" << multiply(x,y);
Enter the first integer::10
Enter the second integer::2
Product of X and Y is::20
In the above example the product of the numbers are calculated by passing the copy of values for "x,y" to the variables "a,b" in the function "multiply" This is the function calls in C++.