Calling a function by value copies the argument and stores it in a local variable for use by the function, so the argument is unaffected if the value of the local variable changes.
The argument is passed to the function as a reference rather than a copy, so if the function changes the value of the argument, the argument is also changed.
The void change(int); function prototype informs the compiler that there is a function named change that takes a single int argument and returns void (i.e. nothing).
Because there is no & with the argument, it is called by value.
You have the line change(orig); later in your code, which actually calls the function with.
Take a look at the output of ...READ MORE
Jun 7, 2022
in C++
by
Damon
• 4,960 points
•
622 views