title: Instantiating a list of structs in C
body: <p>I'm sure this must have been asked before but I can't seem to find an answer anywhere.  I have a struct defined in a header file as so:</p>
  
  <pre><code>struct lock {
      char *name;
      // add what you need here
      void *holder;
      // (don't forget to mark things volatile as needed)
  };
  </code></pre>
  
  <p>I want to make a list of lock objects.  That way I can say something like:</p>
  
  <pre><code>lock_list[0] = create_lock();
  lock_list[1] = create_lock();
  </code></pre>
  
  <p>I tried different ways but they all give me errors.  I thought I could simply say: </p>
  
  <pre><code>lock[2] lock_list;
  </code></pre>
  
  <p>but it didn't work.  Any help would be much appreciated.</p>