Removing elements from an array of linked list
Hello there,
I've got the following structure:
Code:
struct s_no {
char * word;
struct s_no * next;
};
And then I declared an array of pointers:
Code:
struct s_no *t_test [100];
for (oc = 0; oc < 100; oc++) {
t_test[oc] = NULL;
}
It's a hashing table, so after that the program reads a wordlist and creates the table, where the hash value is the index of t_test and the words that gave that value will be on a linked list starting from that pointer index.
The problem is, I need the program to read a word from a file, calculate the hash to find the index it belongs, search the linked list starting in that index (if there's one) to check if the word is there and if it is, remove the word.
Everything is fine until I try to remove the node. I'm not sure about what to pass as reference or as value so all I get is a huge mess. I'd really appreciate if you guys could help me.
Thanks in advance.
Edit: And by the way, I did call malloc when creating the nodes and passing values. The nodes are just fine, the problem is to remove them.