#include using namespace std; void a(int *p1, int *p2) { cout << endl << "Inside a()" << endl << endl ; cout << "p1 = " << p1 << " and &p1 = " << &p1 << " and *p1 = " << *p1 << endl; cout << "p2 = " << p2 << " and &p2 = " << &p2 << " and *p2 = " << *p2 << endl; p1 = p2; *p1 = 3; *p2 = 4; cout << endl << "Inside a() - after setting p1 to p2" << endl << endl ; cout << "p1 = " << p1 << " and &p1 = " << &p1 << " and *p1 = " << *p1 << endl; cout << "p2 = " << p2 << " and &p2 = " << &p2 << " and *p2 = " << *p2 << endl; } int main() { int i, j, *ptr1, *ptr2; ptr1 = &i; ptr2 = &j; i = 5; j = 6; cout << "Before calling a()" << endl << endl ; cout << "i = " << i << " and &i = " << &i << endl; cout << "j = " << j << " and &j = " << &j << endl; cout << endl; cout << "ptr1 = " << ptr1 << " and &ptr1 = " << &ptr1 << " and *ptr1 = " << *ptr1 << endl; cout << "ptr2 = " << ptr2 << " and &ptr2 = " << &ptr2 << " and *ptr2 = " << *ptr2 << endl; a(ptr1, ptr2); cout << endl << "After calling a()" << endl << endl ; cout << "i = " << i << " and &i = " << &i << endl; cout << "j = " << j << " and &j = " << &j << endl; cout << endl; cout << "ptr1 = " << ptr1 << " and &ptr1 = " << &ptr1 << " and *ptr1 = " << *ptr1 << endl; cout << "ptr2 = " << ptr2 << " and &ptr2 = " << &ptr2 << " and *ptr2 = " << *ptr2 << endl; return 0; }