title: Declaring global variables in the header file or the C source file
body: <p>I am kind of confused about the whole including header files and declaration of variables.</p>
  
  <p>Files I am using are: main.c, lib.h and lib.c.</p>
  
  <h3>main.c</h3>
  
  <pre><code>#include "lib.h"
  
  void main(void)
  {
      // Code here
      var++;
  }
  </code></pre>
  
  <h3>lib.c</h3>
  
  <pre><code>#include &lt;avr/io.h&gt;
  #include "lib.h"
  
  void light_led(void)
  {
      // Code here
  }
  </code></pre>
  
  <h3>lib.h</h3>
  
  <pre><code>volatile int var;
  
  void light_led(void);
  </code></pre>
  
  <p>Is this the correct way of making and including your own custom-made libraries?</p>