#include using namespace std; void f(int *j); // f() declares a pointer parameter void af(int *j); int main() { int i = 0; int a[15]; a[2] = 0; int *p; int *ap; p = &i; // p now points to i ap = &a[2]; f(p); // pass a pointer af(ap); cout << "\n"; cout << "i = " << i; // i is now 100 cout << "\n"; cout << "a[2] = " << a[2]; cout << "\n"; return 0; } // f() receives a pointer to an int. void f(int *j) { *j = 100; // var pointed to b } void af(int *j) { *j = 42; }