// this file illustrates pointers to integers, objects, and functions. #include void f(int* x) { *x = 6; } void g(int x) { x = 6; } class cell { public: int car; cell* cdr; cell(int initial) { car = initial; cdr = 0; // 0==NULL } }; int f1(int x) { return x+2; } int f2(int y) {return y-2; } int f3(int x, int (*fun)(int)) { return (*fun) (x); } void main() { int a; int* b; /* a = 5; b = &a; cout << "\n the value of b is " << b; cout << "\n the value of *b is " << *b; cell c(3); cell* d; d = new cell(4); cout << "\n the value of c.car is " << c.car; cout << "\n the value of d->car is " << d->car; cout << "\n the value of (*d).car is " << (*d).car; */ cout << "\n\n what is f3(5,f1)? Answer: " << f3(5,f1); cout << "\n what is f3(5,f2)? Answer: " << f3(5,f2); cout << "\n"; }