title: Avoiding Circular Dependency in C header files
body: <pre><code> header1.h   
          -----------------
          struct A{
          int a;
          B *b;
          };
  
      header2.h  
      -------------------
      #include"header1.h"
  
      typedef struct b{
      int aa;
      char bb;
      int cc;
      }B;
  
      main.c  
      --------------------
      #include&lt;header2.h&gt;
  
      main(){
  
      struct A *ace;
      ace = malloc(sizeof(struct A));
      ace-&gt;b = malloc(sizeof(B));
      }
  </code></pre>
  
  <p>The problem: Basically, header1.h needs to use a struct defined in header2.h.  </p>
  
  <p>The Dilemma: Since header2.h includes header1.h, If i include header2.h in header1.h I will be introducing a circular dependency.   </p>
  
  <p>Some solutions: One way to solve the problem would be use a void pointer, but is there any other way? I tried forward declaring it, but it says "redifining a typedef".</p>