/* program to add one to function parameter - illustrate pass by reference using pointers */ #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"); return 0; } /* function that adds one to its parameter */ void add1(int *x) //x is receiving the address of k { cout << "in function - before adding: " << *x << endl; (*x)++; cout << "in function - after adding: " << *x << endl; return; }