title: Inclusion cycles in C header files
body: <p>How does one prevent an inclusion cycle in C? ie. You shouldn't have a.h #include "b.h", which #include's "c.h" which #include's "a.h". I'm looking for a way of preventing this from happening using some sort of C directive.</p>
  
  <p>I had originally thought this would've prevented this from happening:</p>
  
  <p>Contents of a.h:</p>
  
  <pre><code>#ifndef __A_H
  #define __A_H
  
  #include "b.h"
  
  #endif // __A_H
  </code></pre>
  
  <p>Contents of b.h:</p>
  
  <pre><code>#ifndef __B_H
  #define __B_H
  
  #include "c.h"
  
  #endif // __B_H
  </code></pre>
  
  <p>Contents of c.h:</p>
  
  <pre><code>#ifndef __C_H
  #define __C_H
  
  #include "a.h"
  
  #endif // __C_H
  </code></pre>
  
  <p>But it doesn't seem to work.</p>