/* Program to explore memory layout by printing addresses */
#include <stdio.h>

/* Use modulo to examine only the last four digits of the address */
#define DIGITS 10000L

int
main (void)
{
  int a = 42;
  double x = 3.14;
  char s[6] = "Hello";

  printf ("a address: %lu\tvalue: %d\n", ((unsigned long)&a) % DIGITS, a );
  printf ("x address: %lu\tvalue: %lf\n", ((unsigned long)&x) % DIGITS, x );
  printf ("s address: %lu\tvalue: %s\n", ((unsigned long)&s) % DIGITS, s );

  return 0;
}
