I'm using a hash function I found online that's meant to be quick but it's throwing an error that I don't understand (and as I've cut and paste it, I don't get what the issue can be?). Everything else is working (I used a different hash function initially to test it).
int hash_function(const char* word)
{
unsigned int hash = 0;
for (int i = 0, n = strlen(word); i < n; i++)
hash = (hash << 2) ^ word[i];
return index % HASHSIZE;
}
The error its throwing me is:
dictionary.c:42:18: error: invalid operands to binary expression ('char *(*) (const char *, int)' and 'int')
return index % HASHSIZE;
~~~~~ ^ ~~~~~~~~
1 error generated.
make: *** [dictionary.o] Error 1
Any idea what's wrong? This is the third hash function I've tried to use that hasn't worked once I've put it into my code so I'm obviously missing something!