title: Global struct in c
body: <p>I'm having difficulty figuring out how to initialize global structs to be used as a linked list. I have tried several things already but I have basically this:</p>
  
  <pre><code>#includes....
  
  struct reuqest_struct
  {
  struct timeval request_time;    
  int type;           
  int accountNums[10];        
  int transAmounts[10];       
  struct request_struct *next;    
  struct request_struct *prev;    
  
  };
  
  // global structs I want
  struct request_struct head;
  struct request_struct tail;
  
  
  int main(int argc, char * argv[]){
  
     head = {NULL, 5, NULL, NULL, tail, NULL};
     tail = {NULL, 5, NULL, NULL, NULL, head};
  
  }
  
  void * processRequest(){
  
     // Want to access the structs in here as well
  
   }
  </code></pre>
  
  <p>I try to initialize them this way but just get</p>
  
  <p>"error: expected expression before ‘{’ token</p>
  
  <p>error: ‘head’ has an incomplete type</p>
  
  <p>error: expected expression before ‘{’ token</p>
  
  <p>error: ‘tail’ has an incomplete type"</p>
  
  <p>Is there any way to do this properly?</p>
  
  <p>Also, I will be accessing this linked list of global structs in many threads. So am I right in thinking that I will be able to access any request_struct's  between head and tail as long as they are referenced to by prev or next?</p>
  
  <p>Thanks</p>