title: C forward declaration of struct in header
body: <p>I am trying to pass <code>struct</code> pointer in function. I have a <code>typedef</code> in file1.h, and want to only include that header to file2.c, because file2.h only need pointer. In C++ I would just write like I did here, but using C99 it doesn't work. If someone has any suggestions how to pass <code>struct</code> pointer without full definition it would be very appreciated. Compiler - gcc.  </p>
  
  <p>file1.h</p>
  
  <pre><code>typedef struct
  {
      ...
  } NEW_STRUCT;</code></pre>
  
  <p>file2.h</p>
  
  <pre><code>struct NEW_STRUCT;
  
  void foo(NEW_STRUCT *new_struct); //error: unknown type name 'NEW_STRUCT'</code></pre>
  
  <p>file2.c</p>
  
  <pre><code>#include "file2.h"
  
  #include "file1.h"
  
  void foo(NEW_STRUCT *new_struct)
  {
      ...
  }</code></pre>