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

void print_tags (char *p, int size) {
  char *tag1, *tag2;
  int i;

  tag1 = p - 8;
  for (i=0; i<size + 16; i++) {
    printf ("%d ", *(tag1 + i));
  }
  printf ("\n");
}

int main ()
{
  int x = 5;
  int *px = &x;
  char *py;
  char *pz;
  int s1 = 6;
  int s2 = 8;

  printf ("Address of x is 0x%.8x\n", &x);
  printf ("Value of  px is 0x%.8x\n", px);
  printf ("Value px points to is %d\n", *px);

  py = malloc(s1);
  memset(py, 127, s1);
  printf ("Value of  py is 0x%.8x\n", py);

  print_tags(py, s1);
  free(py);
  print_tags(py, s1);

  pz = malloc(s2);
  memset(pz, 127, s2);
  printf ("Value of  pz is 0x%.8x\n", pz);
  print_tags(py, s1);

  return 0;
}
  
