Initialize new Hash Table, pointers issue : <p>I have this exercise for homework that follows:</p>

<p>Consider the following definition to represent dynamic hashtables with collision treatment chaining.</p>

<pre><code>typedef struct entry{
   char key[10];
   void *info;
   struct entry *next;
}   *Entry;

typedef struct hashT{
   int hashsize;
   Entry *table;
}   *HashTable;
</code></pre>

<p>Define `HashTable newTable(int hashsize) 
note that the memmory necessary must be allocated and that all table entrys must be initialized with empty list.</p>

<p>My proposition is this:</p>

<pre><code>HashTable newTable(int hashSize){
   Entry *table = malloc(sizeof((struct entry)*hashSize));
   HashTable *h = malloc(sizeof(struct hashT));
   h-&gt;hashSize = hashSize;
   h-&gt;table = table;
   return h;
}
</code></pre>

<p>im pretty sure the logic is correct. my problem is with pointers. for example, sometime I see (char *), or in this case (table *) before the malloc function... Is this necessary?</p>

<p>and for the return, should I return h, or *h? and whats the difference?</p>

<p>thank you</p>
