Code /* * demoref.cpp * CIS 250 * David Klick * 2005-01-24 * * Demonstration of a reference variable */ #include void change1(int); void change2(int&); int main(void) { using std::cout; using std::endl; int x = 0; cout << "Before calling functions: " << x << '\n'; change1(x); cout << "After change1() function: " << x << '\n'; change2(x); cout << "After change2() function: " << x << '\n'; return 0; } void change1(int n) { n = 1; } void change2(int& n) { n = 2; } /* Sample output: Before calling functions: 0 After change1() function: 0 After change2() function: 2 */