title: Share global variable between .c file
body: <p>Hi I just wondering how to Share global variable between .c file.<br>
  I try to add follow code, but still get error.</p>
  
  <p>test.c file</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int max = 50;
  int main() 
  {
    printf("max %d", max); // result max 50
  }
  </code></pre>
  
  <p>pass.h</p>
  
  <pre><code>extern int max;
  </code></pre>
  
  <p>passed.c</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include "pass.h"
  
  max;
  
  int main()
  {    
      printf("pass %d \n", max);
  
      return 0;
  }
  </code></pre>
  
  <p>But when I compile passed.c I get follow error</p>
  
  <pre><code>Undefined symbols for architecture x86_64:
  "_max", referenced from:
    _main in passed-iOMugx.o
  ld: symbol(s) not found for architecture x86_64
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
  </code></pre>
  
  <p>Can anyone help? Thank you so much.</p>