// Ch. 10 Demo Program #1
// Mr. Minich

#include <iostream.h>

int main()
{
	int number = 5;
	int another = 8;

	int *pPointer;		// pPointer is a pointer variable
				//   set to point to an int
				//   but it does not point to any
				//   specific variable yet

	cout << "The uninitialized pPointer variable is currently storing " <<
		"the memory address, " << pPointer << endl;

	*pPointer = number;		// Now pPointer points to number

	cout << "pPointer now stores the address, " << pPointer;

	// If this address is the same as the initial address, its simply
	// because the compiler "looks ahead" and uses memory efficiently.

	cout << ", which stores the value of number." << endl;

	cout << "The value of number is " << *pPointer << endl;

	*pPointer = *pPointer + 1; // incrementing number indirectly

	cout << "The new value of number is " << *pPointer << endl;

	return 0;
} // end of main