Why is my code not running?

it is giving ( double free or corruption (fasttop) ) error. please help.
code :- https://ide.codingblocks.com/s/290444

Modified Code

i hope this helps
if yes hit a like and don’t forgot to mark doubt as resolved :grinning:
if you have more doubts regarding this feel free to ask

this is not working correctly

the new hash table size should have been ( 2*7 + 3 ) => 17 , but it is still 7

the problem is occuring in the delete oldTable[i] statement

if i remove that statament , then the code is working fine

also if i try to deallocate the linklists after all the key value pairs are inserted in the new hashtable, then also the same error of double free of corruption is coming , please check why the error is coming

Please help, not able to figure out the error

yes
let me check why it is happening
because this is my code which is same as yours
but it is running fine
you can also check
let me know if you find mistake

My Code

Why are you doing current_size++ after calling insert() in the rehash()

Isn’t that wrong, you are basically Inserting a key value pair in the new hash table( the insert() will automatically increment the current size after inserting the given pair), but you are again doing current_size++ in the rehash()

Can anyone please solve my doubt

in rehash we have set current size to 0 so we have to increase current_size in rehash also

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.