title: Using malloc in C to allocate space for a typedef'd type
body: <p>I'm not sure exactly what I need to use as an argument to <code>malloc</code> to allocate space in the <code>table_allocate(int)</code> function. I was thinking just <code>count_table* cTable = malloc(sizeof(count_table*))</code>, but that doesn't do anything with the size parameter.  Am I supposed to allocate space for the <code>list_node_t</code> also?  Below is what I am working with. </p>
  
  <p>In the .h file I'm given this signature:</p>
  
  <pre><code>//create a count table struct and allocate space for it                         
  //return it as a pointer                                                        
  count_table_t* table_allocate(int);
  </code></pre>
  
  <p>Here are the structs that I'm supposed to use:</p>
  
  <pre><code>typedef struct list_node list_node_t;
  
  struct list_node {
    char *key;
    int value;
  
    //the next node in the list                                                   
    list_node_t *next;
  };
  
  typedef struct count_table count_table_t;
  
  struct count_table {
    int size;
    //an array of list_node pointers                                              
    list_node_t **list_array;
  };
  </code></pre>