Question: This is the insert function of Hashtable in C. I think my code is correct, but it says that I have a segmentation fault. How

 This is the insert function of Hashtable in C. I think

This is the insert function of Hashtable in C.

I think my code is correct, but it says that I have a segmentation fault. How do I fix it?

void ht_put (hashtable_t ht, char xkey, void val) FIXME: the current implementation doesn't update existing entries / unsigned int idx-: hash(key) % ht->size; bucket t *bmalloc(sizeof (bucket t)) while (b) if (strcmp (b->key, key) 0) ht->buckets [idx]=val; return; b->val=val ; b->key key; b->next ht->buckets [idx]; ht->buckets [idx]b

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!