unsigned hash(char *s)
/* Form hash value from string s */
{
unsigned hash_val;
for (hash_val= 0; *s != '\0'; s++)
hash_val= *s + 31*hash_val;
return hash_val % SIZE_OF_HASH_TABLE;
}
Note: use of pointer (not array index) to step through the string.
Note: use of for as a while, again.
maspjw@