Question: ou will now extend the functionality of the map library we are constructing. Add the functions to the appropriate C file as the naming above

ou will now extend the functionality of the map library we are constructing. Add the functions to
the appropriate C file as the naming above would indicate.
i.(10 points) Write a function called map add ordered key that takes 4 arguments:
(1) a pointer to struct map list,
(2) a key to add, and
(3) the value corresponding to the added key.
(4) a function pointer with the signature int cmp key(char *item key, char *add key)
As with the normal add function, this function should find a node on the free-list and add it
to the list. However, this function should repeatedly call the cmp key function provided with
the key to add and the current list items key. The cmp key function should match the API of
strncmp (returning -1,0, and 1 respectively). The map add ordered key function should find
locate the first equal item (or the end of the list), and insert the new node. As with regular
add, this function should return 0 if the item is added successfully, and -1 if not

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 Programming Questions!