// ************************************************************** //
//  Jeff Balsley  11/6/2001                                       //
//                                                                //
// ************************************************************** //
//  Known Bugs                                                    //
//                                                                //
// ************************************************************** //

#include<iostream>
using namespace std;

// Function declarations
void swapPointers(int* ptr0, int* ptr1);
void swapPointers2(int** ptr0, int** ptr2);

int main(void)
{
	int num1 = 3;
	int num2 = 9;

	int * num1_p;
	int * num2_p;

	int ** num1_pp;
	int ** num2_pp;

	num1_p = &num1;
	num2_p = &num2;

	num1_pp = &num1_p;
	num2_pp = &num2_p;

	// *** part a *** //
	/*
	cout << "\nnum1 = " << num1 << "\n*num1_p = " << *num1_p << 
		"\n**num1_pp = " << **num1_pp << "\n";
	cout << "\nnum2 = " << num2 << "\n*num2_p = " << *num2_p << 
		"\n**num2_pp = " << **num2_pp << "\n";
	*/
	// *** part b; Printing the value of the pointers *** //
	
	cout << "\nValue of num1_p = " << num1_p;
	//cout << "  *num1_p = " << *num1_p << "\n";
	cout << "\nValue of num1_pp = " << num1_pp << "\n";
	cout << "\nValue of num2_p = " << num2_p;
	//cout << "  *num2_p = " << *num2_p << "\n";
	cout << "\nValue of num2_pp = " << num2_pp << "\n";
	
	//cout << "address of num1_pp = " << &num1_pp << "\n";
	
	// *** part c; swaping poniters *** //
	/*
	swapPointers(num1_p, num2_p);
	// print the value of the pointers again //
	cout << "Value of num1_p = " << num1_p;
	cout << "  *num1_p = " << *num1_p << "\n";
	cout << "Value of num2_p = " << num2_p;
	cout << "  *num2_p = " << *num2_p << "\n";
	*/
	// *** part d *** //


	return 0;
}

void swapPointers(int* ptr0, int* ptr1)
{
	cout << "\n**** Enter swapPointers ****\n\n";
	int * temp_p;
	temp_p = ptr0;
	ptr0 = ptr1;
	ptr1 = temp_p;
	cout << "Value of ptr0 = " << ptr0;
	cout << "  *ptr0 = " << *ptr0 << "\n";
	cout << "Value of ptr1 = " << ptr1;
	cout << "  *ptr1 = " << *ptr1 << "\n";
	cout << "\n**** Exit swapPointers ****\n\n";
}

void swapPointers2(int** ptr0, int** ptr2)
{
	//int temp;
}