Note: I assume you meant printf("%d\n", slot);
in the last statement.
By doing a modulo with 30, you are effectively restricting the hash value to only 30 unique values (0 to 29). This drastically reduces the effectiveness of the hash, as many different strings will be mapped to the same hash value (one out of those 30).
This link gives you a number of alternative hash functions, including an unsigned int version of the djb2
algorithm in your question. Use one of them instead.