fork download
  1. /* At file scope, all objects have static storage duration */
  2. /* Both 'extern' and 'static' mean static storage duration */
  3.  
  4. /* Tentative definition */
  5. /* External linkage */
  6. int test1;
  7.  
  8. /* Definition */
  9. /* External linkage */
  10. int test2 = 42;
  11.  
  12. /* Tentative definition */
  13. /* External linkage */
  14. int test3;
  15.  
  16. /* Actual definition for the object on line 14 */
  17. /* Still external linkage */
  18. int test3 = 42;
  19.  
  20. /* Neither a tentative definition nor a definition */
  21. /* External linkage */
  22. extern int test4;
  23.  
  24. /* Neither a tentative definition nor a definition */
  25. /* External linkage */
  26. extern int test5;
  27.  
  28. /* Actual definition for the object on line 26 */
  29. /* Still external linkage */
  30. extern int test5 = 42;
  31.  
  32. /* Tentative definition */
  33. /* Internal linkage */
  34. static int test6;
  35.  
  36. /* Tentative definition */
  37. /* Internal linkage */
  38. static int test7;
  39.  
  40. /* Actual definition for the object on line 38 */
  41. /* Still internal linkage */
  42. static int test7 = 42;
  43.  
  44. /* Tentative definition */
  45. /* Internal linkage */
  46. static int test8;
  47.  
  48. /* Actual definition for the object on line 46 */
  49. /* Still internal linkage, despite 'extern'! */
  50. extern int test8 = 42;
  51.  
  52. int main(void) { return 0; }
  53.  
  54. /*
  55.  * Since no other definition was given for 'test1', the
  56.  * tentative definition on line 6 becomes the actual
  57.  * definition with a zero value, equivalent to as if it
  58.  * had been:
  59.  
  60. int test1 = 0;
  61.  
  62.  */
  63.  
  64. /*
  65.  * Since no other definition was given for 'test6', the
  66.  * tentative definition on line 34 becomes the actual
  67.  * definition with a zero value, equivalent to as if it
  68.  * had been:
  69.  
  70. static int test6 = 0;
  71.  
  72.  */
Success #stdin #stdout 0.01s 1716KB
stdin
Standard input is empty
stdout
Standard output is empty