// program to add one to function parameter // illustrate pass by reference #include using namespace std; void add1(int &); //function prototype int main() { int k = 5; cout << "in main - before call: "<< k << endl; add1(k); cout << "in main - after call: "<< k << endl; // system("pause"); //un-comment when using DevC++ return 0; } /* function that adds one to its parameter */ void add1(int &x) //x is receiving a reference to k { cout << "in function - before adding: " << x << endl; x++; cout << "in function - after adding: " << x << endl; return; }