#define HASHSIZE 31 #define HASH_STATUS_EMPTY 0 #define HASH_STATUS_FULL 1 #define HASH_STATUS_USED 2 struct stringval { char *str; int val; }; struct hashentry { struct stringval sval; int status; }; /* Return a hash table initialized to empty. */ struct hashentry *hashinit(); /* Insert sval into the hashtable htp. Return 1 on success and 0 on failure. */ int hashinsert(struct stringval sval, struct hashentry *htp); /* Remove sval from the hashtable htp. Return 1 on success and 0 on failure. */ int hashremove(struct stringval sval, struct hashentry *htp); /* Return a pointer to the entry for str in the hashtable htp. Return NULL if not found. */ struct stringval *hashfind(char *str, struct hashentry *htp);