// CSCI 3155: Meeting 19: References (C++)

#include <iostream>

int main() {
  // Allocate a memory cell and initialize it to 0.
  int* p = new int;
  *p = 0;

  // Create an alias to the allocated cell.
  int& r = *p;

  // Change the cell.
  r = 1;

  // Show the contents.
  std::cout
    << "r is "     << r << "\n"
    << "3 + r is " << 3 + r << "\n"
    << "*p is "    << *p << "\n";

  return 0;
}

