title: invalid use of undefined type when using typedef struct
body: <p>alsa_test.h header file includes the following code:</p>
  
  <pre><code>struct alsa_device;
  typedef struct alsa_device alsa_device;    
  alsa_device *create_alsa_array(size_t n);
  </code></pre>
  
  <p>alsa_test.c file includes:</p>
  
  <pre><code>struct alsa_device 
  {
   int card;
   int dev;
   char info[80];
  };
  typedef struct alsa_device alsa_device;    
  
  alsa_device *create_alsa_array(size_t n) { 
    alsa_device *new = malloc(n * sizeof *new); 
    return new; 
  };
  </code></pre>
  
  <p>and my main.c file has the following:</p>
  
  <pre><code>#include "alsa_test.h"
  
  int main (int argc, char *argv[]) {
       alsa_device *devices;
       create_alsa_array(devices,50);
       devices[0]-&gt;card=1;
  }
  </code></pre>
  
  <p>and I get the following error</p>
  
  <pre><code>error: invalid use of undefined type 'struct alsa_device'
  </code></pre>
  
  <p>any ideas why ?</p>