Posts

Showing posts from January, 2021

Call by value and by reference in function

Image
               Functions in C++ Hello! Everyone in previous blog we learned about function and in today’s blog we will continue previous blog that means we will learn about use of function using call by value and call by reference. What is call by value? basically what we do when we awoke a function we provide value or argument to process with, in the same way we can provide these value to function by these two method. 1.Call by value method 2.Call by reference method 1. Call by value method In the call by value method, the original value can not be changed. When you pass any argument to function, it is stored locally by the function parameter in memory called stack memory. Hence, the values are changed inside the function only and it will not have an effect outside the function.   Here I am giving you an example of swapping two number by call by value by which you can understand this concept better. Example- #include <io...