pass by value and pass by reference

ShivasaiShivasai Member Posts: 16
what is pass by value and pass by reference what is the use of this both diff b/w both and can you explain explicitly give me reference link of this also

Best Answer

  • AluanAluan Member Posts: 158
    Answer ✓
    Hello Shivasai,
    If a parameter is passed by value, then a copy of the variable is passed to the function. Any changes that the function makes to the value of the variable are local changes that affect only the copy, not the variable itself.

    If a parameter is passed by reference, then a reference to the variable is passed to the function. The function can change the value of the variable itself.
    See here:
    https://learn.microsoft.com/en-us/dynamics-nav/c-al-function-calls

Answers

  • AluanAluan Member Posts: 158
    Answer ✓
    Hello Shivasai,
    If a parameter is passed by value, then a copy of the variable is passed to the function. Any changes that the function makes to the value of the variable are local changes that affect only the copy, not the variable itself.

    If a parameter is passed by reference, then a reference to the variable is passed to the function. The function can change the value of the variable itself.
    See here:
    https://learn.microsoft.com/en-us/dynamics-nav/c-al-function-calls
Sign In or Register to comment.