title: C implicit extern for global variable, when does it happen, how does it work
body: <p>I'm trying to understand the ways in which a C global variable can be shared between multiple files (compilation units). I've read the excellent question and answer <a href="https://stackoverflow.com/questions/1433204/what-are-extern-variables-in-c">here</a>. However after doing a few tests I'm still left with some stuff I don't get:</p>
  
  <p>Basically my question would be: if there's a variable declared (but not defined) in a header WITHOUT the <code>extern</code> keyword, is it ok to simply include that header in various compilation units in order to make available that variable to all those compilation units? In this scenario it's implied that one (and only one) compilation unit contains the code for initializing (defining?) that variable, and it will be called first before the other compilation units try to do anything with that variable. If all this is true, is this procedure what's called "implicit extern" ?</p>
  
  <p>I'll illustrate my question with an example:</p>
  
  <p>Header "MyCommonHeader.h" contains:</p>
  
  <pre><code>//MyCommonHeader.h
  int* i; //pointer to an int
  </code></pre>
  
  <p>File MyFirstHeader.h contains:</p>
  
  <pre><code>//MyFirstHeader.h
  void changeIt(int newValue);
  </code></pre>
  
  <p>File MyFirstSource.c contains:</p>
  
  <pre><code>//MyFirstSource.c
  #include "MyFirstHeader.h"
  
   void changeIt(int newValue) {
      *i = newValue;
   }
  </code></pre>
  
  <p>File MySecondSource.c contains:</p>
  
  <pre><code>//MySecondSource.c
  #include "MyCommonHeader.h"
  #include "MyFirstHeader.h"
  
  void main() {
     i = malloc(sizeof(int));
     changeIt(10);
     *i = 23;
  }
  </code></pre>
  
  <p>Does the above code operates with the same i variable everywhere? Do I need to add <code>extern</code>anywhere?</p>