Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database Management Systems

Authors: Mark L. Gillenson

2nd Edition

0470624701, 978-0470624708

More Books

Students also viewed these Databases questions

Question

Which are non projected Teaching aids in advance learning system?

Answered: 1 week ago