title: typedef stuct with forward declaration in C
body: <p>I have something like:</p>
  
  <pre><code>typedef struct Data DATA, *DATA_PTR;
  typedef struct Units UNITS, *UNITS_PTR;
  
  struct Data
  {
      double miscData;
      UNITS units;
  };
  
  struct Units
  {
      double x[2];
      double y[2];
      double z[2];
  };
  </code></pre>
  
  <p>in my <code>project_typedef.h</code> file.</p>
  
  <p>In another file, I have something like: </p>
  
  <pre><code>void fileInput(DATA_PTR data)
  {
       //usual declarations and other things
       data-&gt;miscData = 0; //Works!
       data-&gt;units.x[0] = 5; //Doesn't work
       //etc...
  }
  </code></pre>
  
  <p>However, this doesn't work since units is declared after data in  <code>project_typedef.h</code> (if I switch the order it works). The error that i get is "left of '.x' must have struct/union type". I thought that the forward declaration would fix this issue. Why not?</p>