title: how to access global variable in other module?
body: <p>I'm new to C, still struggling in understanding global variable,below is my code:</p>
  <pre><code>//test.c
  
  int globalVariable = 2020;
  </code></pre>
  <pre><code>//main.c
  
  #include &lt;stdio.h&gt;
  #include &quot;test.c&quot; // I just include c file for demo purpose
  
  int main()
  {
     printf(&quot;Value is %d&quot;, globalVariable);
  }
  </code></pre>
  <p>and there is comile error which says globalVariable already defined in Main.obj</p>
  <p>but we know that any global variable or function declared without the static attribute is public and can be accessed by any other module, I didn't define <code>globalVariable</code> in main.c, where did I go wrong?</p>