home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_12_04 / allison / scope1.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-02-10  |  337 b   |  28 lines

  1. LISTING 1 - Illustrates Local Scope
  2. /* scope1.c:    Illustrate local scope */
  3.  
  4. #include <stdio.h>
  5.  
  6. void f(int val);
  7.  
  8. main()
  9. {
  10.     f(1);
  11.     return 0;
  12. }
  13.  
  14. void f(int i)
  15. {
  16.     printf("i == %d\n",i);
  17.     {
  18.         int j = 10;
  19.         int i = j;
  20.         printf("i == %d\n",i);
  21.     }
  22. }
  23.  
  24. /* Output:
  25. i == 1
  26. i == 10
  27. */
  28.