home *** CD-ROM | disk | FTP | other *** search
/ C Programming Starter Kit 2.0 / SamsPublishing-CProgrammingStarterKit-v2.0-Win31.iso / tyc / list12_5.c < prev    next >
C/C++ Source or Header  |  1993-10-16  |  461b  |  23 lines

  1.  /* Demonstrates local variables within blocks. */
  2.  
  3.  #include <stdio.h>
  4.  
  5.  main()
  6.  {
  7.      /* Define a variable local to main(). */
  8.  
  9.      int count = 0;
  10.  
  11.      printf("\nOutside the block, count = %d", count);
  12.  
  13.      /* Start a block. */
  14.      {
  15.      /* Define a variable local to the block. */
  16.  
  17.      int count = 999;
  18.      printf("\nWithin the block, count = %d", count);
  19.      }
  20.  
  21.      printf("\nOutside the block again, count = %d", count);
  22.  }
  23.