title: How do I share a global variable between c files?
body: <p>If I define a global variable in a <code>.c</code> file, how can I use the same variable in another <code>.c</code> file?</p>
  <p><code>file1.c</code>:</p>
  <pre><code>#include&lt;stdio.h&gt;
  
  int i=10;
  
  int main()
  {
      printf(&quot;%d&quot;,i);
      return 0;
  }
  </code></pre>
  <p><code>file2.c</code>:</p>
  <pre><code>#include&lt;stdio.h&gt;
  
  int main()
  {
      //some data regarding i
      printf(&quot;%d&quot;,i);
      return 0;
  }
  </code></pre>
  <p>How can the second file <code>file2.c</code> use the value of <code>i</code> from the first file <code>file1.c</code>?</p>