I have found some code that I need to use for my application but there are two lines in it I can't figure out what exactly do they do and how... Please, either explain them to me or direct me to a link so I can read more about it.
Dict* dcreate(hash_size size, hash_size (*hashfunc) (const char *)); Here I guess it is passing a function as a parameter with it's parameter in the following bracket!?
hash_size i = dict->hashfunc(key) % dict->size; and here, my guess is as good as my dog's!
The hashfunc:
static hash_size def_hashfunc(const char* key){ hash_size s = 0; while(*key){ s += (unsigned char) *key++; } return s; } Thanks.