title: How to resolve circular struct dependencies in C
body: <p>So I have two structs, which for simplicity we shall call <strong><code>A</code></strong> and <strong><code>B</code></strong>. <strong><code>A</code></strong> contains a pointer to <strong><code>B</code></strong>, and <strong><code>B</code></strong> contains an <strong><code>A</code></strong>. So here is the code:</p>
  
  <p>a.h</p>
  
  <pre><code>#ifndef A_H
  #define A_H
  
  #include "b.h"
  
  typedef struct _A {
      B *b;
  } A;
  
  #endif
  </code></pre>
  
  <p>b.h</p>
  
  <pre><code>#ifndef B_H
  #define B_H
  
  #include "a.h"
  
  typedef struct _B {
      A a;
  } B;
  
  #endif
  </code></pre>
  
  <p>Now the issue is that when I import a.h from my main c file, I get errors about how A is an unknown type from b.h. I'm not sure how to resolve this.</p>