/* testpointer2.cpp CIS 150 David Klick 6/28/05 Passing a pointer to a function. */ #include using std::cout; using std::cin; void getnum(char* prompt, int* p); int main(void) { int n; getnum("Enter an integer: ", &n); cout << "You entered " << n << '\n'; return 0; } void getnum(char* prompt, int* p) { int val; // get integer from user cout << prompt; cin >> val; // store value where calling program requested *p = val; }