this algorithm (k=33) was first reported by dan bernstein many years ago in comp.lang.c. another version of this algorithm (now favored by bernstein) uses xor: hash(i) = hash(i - 1) * 33 ^ str[i]; the magic of number 33 (why it works better than many other constants, prime or not) has never been adequately explained.
Please, can someone explain me meaning of : while (c = *str++)
First you do dereference an uchar pointer and assign (copy) the value to integer variable.
Then you increment the pointer to point to the next character in the string.
Last the value of the expression, i.e the new value of 'c', is used as the condition.
What is the value of the end-of-string character in C-style strings? '\0'.
What is that as integer? 0
What is that as bool? false
THANKS; Peter87, and kaskiverto, I owe U for that!!!
(Task in my book is completely unclearly written, this confuses on the very begiinning!!!!- I thought they thought sth completely diferent!!!)