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 / linkage1.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-02-10  |  919 b   |  52 lines

  1. LISTING 5 -
  2. /* linkage1.c:  Links with linkage2.c */
  3.  
  4. *** NOTE to EDITOR: This must be set in small type and perhaps
  5. span across the page to stay intact - IT MUST NOT WRAP!
  6. Thank you. ***
  7.  
  8. #include <stdio.h>
  9.  
  10. static void f1(int);
  11. static void f2(void);
  12.  
  13. main()
  14. {
  15.     extern void f1(int);    /* Internal Linkage */
  16.     extern void f2(void);   /* Internal Linkage */
  17.     extern void f3(void);   /* External Linkage */
  18.  
  19.     f1(23);
  20.     f2();
  21.     f3();
  22.     return 0;
  23. }
  24.  
  25. int i = 13;                 /* External Linkage */
  26.  
  27. static void f1(int i)       /* Internal Linkage */
  28. {
  29.     for (;;)
  30.     {
  31.         float i = 33.0;     /* No Linkage */
  32.  
  33.         printf("%f\n",i);
  34.         goto exit;
  35.     }
  36.  
  37. exit:                       /* No linkage */
  38.     printf("%d\n",i);
  39. }
  40.  
  41. static void f2(void)        /* Internal Linkage */
  42. {
  43.     printf("%d\n",i);
  44. }
  45.  
  46. /* Output:
  47. 33.000000
  48. 23
  49. 13
  50. 16
  51. */
  52.