title: How can I use a typedef struct from one module as a global variable in another module?
body: <p>I am learning C and I am having some trouble with a bit of homework I was given.</p>
  
  <p>I am attempting to use a linked list that I have implemented as part of one header inside of another header. My implementation of the list includes a <code>typedef</code> that looks like this:</p>
  
  <pre><code>typedef struct queue_T
  {
      int count;
      struct member_T * first;
      struct member_T * last;
  } * queue_T;
  </code></pre>
  
  <p>The above <code>typedef</code> is inside of one source file (<code>.c</code>). I am currently attempting to write a second source file that makes use of this type. Inside this source file, I attempted to declare some <code>queue_T</code> variables for use as global variables. I did so like this:</p>
  
  <pre><code>#include &lt;math.h&gt;
  #include "mathfns.h"
  #include "queue.h"
  
  queue_T primes;
  queue_T squares;
  queue_T cubes;
  
  primes = new_queue();
  squares = new_queue();
  cubes= new_queue();
  </code></pre>
  
  <p><code>new_queue()</code> is my initializer function for the queue_T type and <code>mathfns.h</code> is the header file associated with the source file that you're looking at immediately above this paragraph. The above declarations of queue_T variables are defaulting to integers when I attempt to compile and when I attempt to initialize the variables it is generating an error. How can I avoid this? Should I <code>#include</code> the"<code>queue.h</code> header in the <code>mathfns.h</code> file</p>
  
  <p>Thank you.</p>