#include using namespace std; void functionOne(int data) { cout << "Value of data passed into functionOne: " << data << endl; data = data * 2; cout << "Value of data at end of functionOne: " << data << endl; } void functionTwo(int & data) { cout << "Value of data passed into functionTwo: " << data << endl; data = data * 2; cout << "Value of data at end of functionTwo: " << data << endl; } void functionThree(int *data) { cout << "Value of data passed into functionThree: " << *data << endl; *data = *data * 2; cout << "Value of data at end of functionThree: " << *data << endl; } int main(int argc, char* argv[]) { int x = 5; // pass by value cout << "Value of x before calling functionOne: " << x << endl; functionOne(x); cout << "Value of x after calling functionOne: " << x << endl << endl; // pass by reference cout << "Value of x before calling functionTwo: " << x << endl; functionTwo(x); cout << "Value of x after calling functionTwo: " << x << endl << endl; // pass "with pointer" cout << "Value of x before calling functionThree: " << x << endl; functionThree(&x); cout << "Value of x after calling functionThree: " << x << endl; }