C++

Call by reference & Call by value with example code

seoca 2018. 11. 3. 05:10



Call by reference & Call by value with example code 



Call By Value

If you change the value of the parameter. It modifies the value in the current function only. 

It doesn't affect the value of the variable in the caller.



Call By Reference 

It modifies the value of inside the function as well as outside because a reference (address) is passed. 





Example code 







Output