title: extern linkage of function in C, is it okay to not be with "extern"?
body: <p>Hello I'm viewing an example of external linkage of function and variable in C.</p>
  <p>This is an example that produces random variables.</p>
  <ol>
  <li>random.c</li>
  </ol>
  <pre><code>#define SEED 20
  #define MULT 3124
  #define INC 2345
  #define MOD 5436
  
  unsigned int call_count = 0; 
  
  static unsigned seed = SEED;  
  
  unsigned random_i(void) {
  
      seed = (MULT * seed + INC) % MOD;
  
      call_count++;
  
      return seed;
  
  }
  
  double random_f(void) {
  
      seed = (MULT * seed + INC) % MOD;
      call_count++;
  
      return seed / (double)MOD;
  }
  </code></pre>
  <ol start="2">
  <li>and this is main.c</li>
  </ol>
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt; 
  
  #pragma warning (disable:4996)
  
  unsigned random_i(void); // I wonder why this prototype has no &quot;extern&quot; specifier
  double random_f(void); // I wonder why this prototype has no &quot;extern&quot; specifier
  
  extern unsigned call_count;
  
  int main(void) {
  
      register int i;
  
      for (i = 0; i &lt; 10; i++)
          printf(&quot;%d &quot;, random_i());
  
      printf(&quot;\n&quot;);
  
      for (i = 0; i &lt; 10; i++)
          printf(&quot;%lf &quot;, random_f());
  
      printf(&quot;\nCall count : %d\n&quot;, call_count);
      
      return 0;
  }
  </code></pre>
  <p>in this short program, I wonder why those of two function prototype has no &quot;<em>extern</em>&quot; specifier AND why this code is compiled without an error.</p>
  <p>Because what I know is that when I use variables or functions that is in other source code, I have to do it with <code>extern</code> specifier for example <code>extern int a=10;</code>.</p>
  <p>Please let me know.</p>
  <p>Thanks.</p>