示例代码
hashTable.h
// 开放定址哈希表的存储结构实现头文件#ifndef HASH_TABLE_H
#define HASH_TABLE_H#include "errorRecord.h"#define NULL_KEY -2
#define NUM 10#define SUCCESS 1
#define UNSUCCESS 0
#define DUPLICATE -1#define EQUAL(a, b) ((a) == (b))typedef int KeyType;typedef struct {KeyType key;int order;
} ElemType;typedef struct {ElemType *elem;int count; // 当前数据元素个数int sizeIndex; // g_hashSizeArray[sizeIndex] 为当前 hash 查找表的长度
} HashTable;/*前置条件:table 非空操作结果:构造一个空的哈希表 table
*/
Status InitHashTable(HashTable *table);/*前置条件:table 非空操作结果:销毁一个空的哈希表 table
*/
Status DestroyHashTable(HashTable *table);