Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- node* hashtable[27];
- char* string = malloc(sizeof(char) * LENGTH);
- while(fscanf(dict, "%s", string) == 1)
- {
- if(hashtable[hashkey(string)]->next == 0)
- {
- node* newnode = calloc(1, sizeof(node));
- //newnode->next = hashtable[hashkey(string)];
- hashtable[hashkey(string)]->next = newnode;
- //newnode->word = string;
- strcpy(newnode->word, string);
- //hashtable[hashkey(string)]->next = newnode;
- }
- else if(hashtable[hashkey(string)] != NULL)
- {
- node* newnode = calloc(1, sizeof(node));
- strcpy(newnode->word, string);
- //newnode->word = string;
- newnode->next = hashtable[hashkey(string)];
- hashtable[hashkey(string)] = newnode;
- }
- }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement