#include <iostream>
using namespace std;

void squareMe(int *);

int main()
{
	int a;
	int *aPtr = NULL;	// that which aPtr points to is an int (4 byte chunk of memory)
	
	aPtr = &a;			// aPtr stores the memory address of a (i.e. aPtr points to a)

	*aPtr = 7;			// that which aPtr points to is 7

	cout << "The address of a is " << &a << endl;				// 0012FF60
	cout << "The value of aPtr is " << aPtr << endl;			// 0012FF60

	cout << "The value of a is " << a << endl;					// 7
	cout << "The value of *aPtr is " << *aPtr << endl << endl;	// 7

	cout << "Since * and & are inverses of each other &*aPtr is " << &*aPtr << 
		" and *&aPtr is " << *&aPtr << endl << endl;

	squareMe(aPtr);	
	//squareMe(&a);

	cout << "After the function, a is " << a << endl;			// 49

	return 0;
}

void squareMe(int *nPtr)
{
	*nPtr = *nPtr * *nPtr;
}
