What is the diffrence between function call by valu and call by refrence.
function
Collapse
X
-
As you have posted a question in the articles setion it is being moved to the Software Development Forum.
MODERATOR. -
The difference is concerned with how parameters are passed to a function. With call by reference, any parameters passed refer to the actual variable, whereas with call by value the parameters refer to the VALUE of the variable, not the variable itself. Consider the following example:
Code:int mainProgram() int x = 3; addOne (x); return x; End void addOne(int x) x = x + 1; End
However, if it uses pass by reference, mainProgram will return 4 (as addOne incremented the variable, not just the value).
Hope this helps. (If not, hopefully someone else will be able to explain it to you better)Comment
Comment