/* pointers.cpp --  Playing with addresses of variables and their contents:
 */

#include <iostream>

void moo(int a, int *b, int& c){
  cout << "Address of a = " << (int)&a << ", Value of a = " << a << endl;
  cout << "Address of b = " << (int)&b << ", Value of b = " << (int)b 
       << ", Value of *b = " << (int)*b << endl;
  cout << "Value of c = " << (int)&c << ", Value of *c = " << c  << endl;
}

int main(void) {
  int x = 5;

  cout << "Address of x = " << (int)&x << ", Value of x = " << x << endl;
  moo(x, &x, x); // This is done only so that you see how addresses work
                 // This is a terrible way to call a function
}


/* Output from running this program on my computer:

Address of x = 536869664, Value of x = 5
Address of a = 536869520, Value of a = 5
Address of b = 536869528, Value of b = 536869664, Value of *b = 5
Value of c = 536869664, Value of *c = 5

 */
