title: Including a header file from another directory
body: <p>I have a main directory <code>A</code> with two sub directories <code>B</code> and <code>C</code>.</p>
  
  <p>Directory <code>B</code> contains a header file <code>structures.c</code>:</p>
  
  <pre><code>#ifndef __STRUCTURES_H
  #define __STRUCTURES_H
  typedef struct __stud_ent__
  {
      char name[20];
      int roll_num;
  }stud;
  #endif
  </code></pre>
  
  <p>Directory <code>C</code> contains <code>main.c</code> code:</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;stdlib.h&gt;
  #include &lt;structures.h&gt;
  int main()
  {
      stud *value;
      value = malloc(sizeof(stud));
      free (value);
      printf("working \n");
      return 0;
  }
  </code></pre>
  
  <p>But I get an error:</p>
  
  <pre class="lang-none prettyprint-override"><code>main.c:3:24: error: structures.h: No such file or directory
  main.c: In function ‘main’:
  main.c:6: error: ‘stud’ undeclared (first use in this function)
  main.c:6: error: (Each undeclared identifier is reported only once
  main.c:6: error: for each function it appears in.)
  main.c:6: error: ‘value’ undeclared (first use in this function)
  </code></pre>
  
  <p>What is the correct way to include the <code>structures.h</code> file into <code>main.c</code>?</p>