Advertisement
Guest User

Untitled

a guest
Jan 30th, 2015
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.23 KB | None | 0 0
  1.  
  2. #include "inc.h"
  3. int hash(char* string, int tsize) {
  4.  
  5. int hash;
  6. int i, sum = 0;
  7.  
  8. for (i = 0; string[i] != '\0'; ++i) {
  9. sum += (int) string[i];
  10. }
  11.  
  12.  
  13.  
  14. hash = sum % tsize;
  15.  
  16. return hash;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement