Pass-By-Value vs. Pass-By-Reference

Could anyone confirm this for me?

So, my understanding of pass-by-value is: the value that was passed into the function, and the value within that function will change. However, the parameter of that value from main will not.

For pass-by-reference: the value that was passed into the function, and the value within that function will change. In addition, that value will change the parameter of that value from main.

The exact wording may not be correct, but is the general idea of it correct?
Last edited on
One clarification.

The OP refers to the value changing (by reference) or not changing (by value) in main.
The value will change or not change in the caller. The calling function might not be main().



Topic archived. No new replies allowed.