Difference between value parameter and reference parameter ? This question is asked sometime by interviewers during my interviews. Can someone tell me the exact difference that is easy to explain with example? And is reference parameter and pointer parameter are same thing ?
Thanks
Changes to a value parameter are not visible to the caller (also called “pass by value”).
Changes to a reference parameter are visible to the caller (“pass by reference”).
C++ example:
One use of pointers is to implement “reference” parameters without using a special reference concept, which some languages, such as C, don’t have. (Of course you can also treat pointers as values themselves.)