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

  1.    /* Demonstrates local variables. */
  2.  
  3.    #include <stdio.h>
  4.  
  5.    int x = 1, y = 2;
  6.  
  7.    void demo(void);
  8.  
  9.    main()
  10.   {
  11.       printf("\nBefore calling demo(), x = %d and y = %d.", x, y);
  12.       demo();
  13.       printf("\nAfter calling demo(), x = %d and y = %d.", x, y);
  14.   }
  15.  
  16.   void demo(void)
  17.   {
  18.       /* Declare and initialize two local variables. */
  19.  
  20.       int x = 88, y = 99;
  21.  
  22.       /* Display their values. */
  23.  
  24.       printf("\nWithin demo(), x = %d and y = %d.", x, y);
  25.   }
  26.