/* CSE 333 Su12 Lecture 2 demo: varscope.c */
/* Gribble/Perkins */

/* Demonstrate scope of variables */

/* May need to compile with -std=c99 */

#include <stdio.h>

int main(int argc, char **argv) {
  int x, y = 5;   // note x is uninitialized(!)
  long z = x+y;

  printf("z is '%ld'\n", z); // what's printed?
  {
    int y = 10;
    printf("y is '%d'\n", y);
  }
  int w = 20;  // ok in c99
  printf("y is '%d', w is '%d'\n", y, w);
  return 0;
}