Can I use a single pointer for my hash table in C?
Posted
by aks
on Stack Overflow
See other posts from Stack Overflow
or by aks
Published on 2010-05-17T13:23:33Z
Indexed on
2010/05/17
13:40 UTC
Read the original article
Hit count: 142
c
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?
© Stack Overflow or respective owner