title: Access a global static variable from another file in C
body: <p>In C language, I want to access a global static variable outside the scope of the file. Let me know the best possible way to do it.
  One of the methods is to assign an extern global variable the value of static variable,</p>
  
  <p>In file a.c</p>
  
  <pre><code>static int val = 10;
  globalvar = val;
  </code></pre>
  
  <p>In file b.c</p>
  
  <pre><code>extern globalvar;
  </code></pre>
  
  <p><strong>But in this case any changes in val(file a.c) will not be updated in globalvar in (file b.c).</strong></p>
  
  <p>Please let me know how can I achieve the same.</p>
  
  <p>Thanks,
  Sikandar.</p>