/* testpointer1.cpp CIS 150 David Klick 6/26/08 Simple pointer demonstration. */ #include using std::cin; using std::cout; void cont(); int main() { int n; // create a pointer and make it point to n int *ptr = &n; n = 7; cout << n << '\n'; // equivalent to: n = n + 1 *ptr = *ptr + 1; cout << n << '\n'; cont(); return 0; } /* void cont(); Arguments: none Returns: nothing Clears input buffer and pauses waiting for user to press Enter. */ void cont() { if (cin.rdbuf()->sungetc() != -1 && cin.get() != '\n') cin.ignore(80,'\n'); cout << "Press enter to continue..."; cin.get(); }