Can I use a single pointer for my hash table in C?
- by aks
I want to implement a hash table in the following manner:
struct list
{
char *string;
struct list *next;
};
struct hash_table
{
int size; /* the size of the table */
struct list **table; /* the table elements */
};
Instead of struct hash_table like above, can I use:
struct hash_table
{
int size; /* the size of the table */
struct list *table; /* the table elements */
};
That is, can I just use a single pointer instead of a double pointer for the hash table elements? If yes, please explain the difference in the way the elements will be stored in the table?