home *** CD-ROM | disk | FTP | other *** search
/ C by Discovery (4th Edition) / C_By_Discovery_4th_Edition.tar / C_By_Discovery_4th_Edition / _DISK_ / ch2 / block.c next >
C/C++ Source or Header  |  2005-06-16  |  756b  |  27 lines

  1. /*                       block.c
  2.  *
  3.  *   Synopsis  - The values of two variables named i are
  4.  *               displayed. They are declared in two
  5.  *               different blocks.
  6.  *
  7.  *   Objective - To illustrate block structuring of C source 
  8.  *               code.
  9.  */
  10.  
  11. /* Include Files */
  12. #include <stdio.h>
  13.  
  14. int main( void )
  15. {
  16.      int i = 3;
  17.  
  18.      {                                            /* Note 1 */
  19.           int i = 5;                              /* Note 2 */
  20.                                                   /* Note 3 */
  21.           printf("In the inner block, i is %d.\n", i);
  22.      }
  23.                                                  /* Note 4 */
  24.      printf("In the outer block, i is %d.\n", i);
  25.      return 0;
  26. }
  27.