我正在研究一个哈希表,但没有走得太远。我的问题是如何将表格设置为大小。(阅读下面的说明以获得澄清)。
这是我应该做的:
/**
* Create a new instance of struct hashStorage and return it. It sets the size of the
* table to be of length "size" which will be the number of the entries in the hash. It takes also an
* argument to specify the format of the order printed to an output stream. If myHash parameter
* is NULL then this means that the hash should be a linked list. When myHash is NULL the size
* parameter should be ignored.
*/
struct hashStorage {
int (*funcHash) (int);
void (*printItem) (struct order *, FILE *);
struct onode** table;
int size;
};
struct hashStorage* createHash(int size, int (*myHash)(int),void(*printOrder)(struct order *, FILE *))
{
struct hashStorage* hashList = (struct hashStorage*) malloc(sizeof(struct hashStorage));
hashList->table;
if(myHash == NULL)
{
}
else
{
}
return hashList;
}
如果有人能解释我的给予和例子将是一个很大的帮助。