I have an implementation of a hash table, where a table structure stores an array of pointers to linked list nodes. I wish to resize the table after a certain point by creating a new table of a bigger size, then hashing all the elements of the old table to the new table. Lastly I will need to free the old table from memory.
Each of the linked list nodes contain a pointer to another structure as their data.
I want to extract the data from each of the nodes and hash them into the new table. When I delete the old table, the new table prints rubbish. Is this because the hashed entries in the old table point to the same location as the entries in the new table? I tried allocating memory to copy the old entries but this doesn't work either, what should I try to do next?
Thanks.