/** Demonstrates how to pass pointers to functions. */ #include using namespace std; void printPtr(int *); // prototype int main() { int number = 5; int *myPtr = &number; printPtr(myPtr); // pass in a pointer printPtr(&number); // pass in an address return 0; } /** * Simple function showing how to pass pointers to functions. * Print the value of nPtr and the value of dereferenced nPtr. */ void printPtr(int *nPtr) { cout << "The value of the pointer is " << nPtr << endl << "The value of the thing pointed to by the pointer is "<< *nPtr << endl; }