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

#include <stdio.h>
#include <stdlib.h>

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

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

  /* Change the cell. */
  *r = 1;

  /* Show the contents. */
  printf("*r is %d\n3 + (*r) is %d\n*p is %d\n", *r, 3 + (*r), *p);

  return 0;
}

