Advertisement
Guest User

Untitled

a guest
Sep 1st, 2015
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. node* hashtable[27];
  2. char* string = malloc(sizeof(char) * LENGTH);
  3. while(fscanf(dict, "%s", string) == 1)
  4. {
  5. if(hashtable[hashkey(string)]->next == 0)
  6. {
  7. node* newnode = calloc(1, sizeof(node));
  8. //newnode->next = hashtable[hashkey(string)];
  9. hashtable[hashkey(string)]->next = newnode;
  10. //newnode->word = string;
  11. strcpy(newnode->word, string);
  12. //hashtable[hashkey(string)]->next = newnode;
  13. }
  14. else if(hashtable[hashkey(string)] != NULL)
  15. {
  16. node* newnode = calloc(1, sizeof(node));
  17. strcpy(newnode->word, string);
  18. //newnode->word = string;
  19. newnode->next = hashtable[hashkey(string)];
  20. hashtable[hashkey(string)] = newnode;
  21. }
  22. }
  23. return true;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement