The code below shows how to call a function in both methods.
Please explain the major differences or meanings of call by value and call by reference to me.
1.Make a value-based call.
2.Call based on a reference.
The call by value method is demonstrated in the following code.
In a comment, I expressed my reservations.
#include<iostream>
int main(){
void change(int);//why function prototype is before function definition and what is
int orig=10;//meaning of argument int, it did not defined any variable of type int
cout<<"The original value is: "<<orig<<"\n";
change(orig);//what is the meaning of this piece of code
cout<<"Value after change() is over:"<<orig<<"\n";
return 0;
};
void change(int orig){
orig=20;
cout<<"Value of orig in function change() is:"<<orig<<"\n";
return;
}