Question: b) The code given in Figure 1 is part of an application that provides functionality to maintain a mini thesaurus using linked lists. You can

 b) The code given in Figure 1 is part of an

b) The code given in Figure 1 is part of an application that provides functionality to maintain a mini thesaurus using linked lists. You can assume that all required #define pre-processor directives will be included in the final version of the source code. #define MAXLEN 20 typedef struct thesaurus { char word [MAXLEN]; char synonym (MAXLEN]; struct list *next; } entry; entry *head= NULL; // Start of linked list. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. int main() { char input [MAXLEN]; // User's input action. while (1) { printf("(A) dd/ (Delete/ (G) et/(L) ist/ (Q) uit "); fgets (input, MAXDEN, stdin); /* Missing code checks user's choice and invokes appropriate function e.g., choosing 'Q' triggers a call to function free_list(). */ } return 0; ) void free list() { entry *del_ptr; while (head != NULL) { del_ptr = head; head = head->next; free (del_ptr); 1 } 24. 25. 26. 27. 28. Figure 1 Answer the questions below: i) Describe the semantics of the following lines of code in Figure 1:22, 24, 25 and 26. Also briefly state the purpose of the function free_list(). ii) Write the code for the function get_entry(), which needs to retrieve and display the synonym for the word in the position number provided as an argument to the function. The function also needs to display the corresponding word. Note: Please assume that the thesaurus' first word is in position 0, the second one is in position 1, etc. Hint: You should make use of the starting code provided in Figure 1. 113 markel

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!