title: How do i share a variable's value between C programs
body: <p>I need to share a variable's value which is modified in one program to reflect in another program..So I did the following.  </p>
  
  <ol>
  <li><p>Created a header file :</p>
  
  <pre><code>/* file1.h */
  extern int a = 0;
  </code></pre></li>
  <li><p>created a C file:</p>
  
  <pre><code>/* file2.c */    
  #include"file1.h"
  #include&lt;stdio.h&gt;
  int main()
  {
      a = 15;
      printf("%d",a);
      return 0;
  }
  </code></pre></li>
  <li><p>created another C file:</p>
  
  <pre><code>/* file3.c */
  #include"file1.h"
  #include&lt;stdio.h&gt;
  int main()
  {
      printf("%d",a);
      return 0;
  }
  </code></pre></li>
  </ol>
  
  <p>I wanted the <code>file3.c</code> program to print the value 15 but it gave the output as 0.
  How do I get the value in <code>file3.c</code> program also?</p>