c - Chained hash-table declaration -
in master algorithm c, author has declared structure of chained hash table below:
typedef struct chtbl_ { int buckets; int (*h)(const void *key); int (*match)(const void *key1, const void *key2); void (*destroy)(void *data); int size; list *table; } chtbl; but thought last 1 should list *table[buckets]; author has used &htbl->table[bucket]. right? why author's definition correctly pass test?why right? thank you!
the table list pointer, , being used represent array of lists. being initialized this:
htbl->table = malloc(sizeof(list) * htbl->buckets);
Comments
Post a Comment