What function modifies the value of the original variable passed as argument ?
void function1(double x) {
x += 1;
}
double function2(double x) {
return x + 1;
}
double function3(double& x) {
return x + 1;
}
void function4(double& x) {
x = x + 1;
}
Note that function2 never assigns x to a new value but only returns a value that is computed using the value of x.