home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_08_12 / 8n12093a < prev    next >
Text File  |  1990-10-09  |  726b  |  45 lines

  1.  
  2. Listing 4
  3.  
  4. ------------------------ globals.h ------------------------------
  5.  
  6. #ifndef GLOBALS_H
  7. #define GLOBALS_H
  8.  
  9. #ifdef DRIVER
  10. #define CLASS
  11. #define INIT (x)    = x
  12. #else
  13. #define CLASS       extern
  14. #define INIT (x)
  15. #endif
  16.  
  17. CLASS char          date[9]   INIT("01-01090");
  18.  
  19. #endif         /* GLOBALS_H */
  20.  
  21. ----------------------- file1.c ---------------------------------
  22.  
  23. #define DRIVER
  24. #include "globals.h"
  25.  
  26. main()
  27. {
  28. strcpy(date, "01-01-90");
  29. foo();
  30. puts(date);
  31. }
  32.  
  33. ---------------------- file2.c ---------------------------------
  34.  
  35. #include "globals.h"
  36.  
  37. foo()
  38. {
  39. puts(date);
  40. strcpy(date, "02-02-90");
  41. puts(date);
  42. }
  43. ----------------------------------------------------------------
  44.  
  45.