/* Program 7.1.1 from C++ Programming Lecture notes  */

/* Author: Rob Miller and William Knottenbelt
   Program last changed: 30th September 2001    */

/* This program illustrates the use of the dereference operator "*"
   and the address-of operator "&". */ 

#include <iostream>
using namespace std;

typedef int *IntPtrType; 

int main()
{
	IntPtrType ptr_a, ptr_b;
	int num_c = 4, num_d = 7;
	
	ptr_a = &num_c;				/* LINE 10 */
	ptr_b = ptr_a;				/* LINE 11 */
		
	cout << *ptr_a << " " << *ptr_b << "\n";
	
	ptr_b = &num_d;				/* LINE 15 */
	
	cout << *ptr_a << " " << *ptr_b << "\n";

	*ptr_a = *ptr_b;			/* LINE 19 */
		
	cout << *ptr_a << " " << *ptr_b << "\n";
	
	cout << num_c << " " << *&*&*&num_c << "\n";
	
	return 0;
}


/* Output is:

4 4
4 7
7 7
7 7

*/

