#include #include using namespace std; void f(int a, int& b, int *p); //function declaration int main() { int i {10}; int j {20}; int k {30}; f(i, j, &k); //The function has the ability to change j and k. cout << "i = " << i << "\n"; //unchanged cout << "j = " << j << "\n"; //changed cout << "k = " << k << "\n"; //changed return EXIT_SUCCESS; } void f(int a, int& b, int *p) //function definition { cout << "f received " << a << ", " << b << ", " << *p << ".\n"; ++a; //Has no effect on i. ++b; //does have an effect on j //++p; //Bad: you can only increment a pointer to an array element ++*p; //has an effect on k. We're incrementing what p points to. }