Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

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

Databases And Python Programming MySQL MongoDB OOP And Tkinter

Authors: R. PANNEERSELVAM

1st Edition

9357011331, 978-9357011334

More Books

Students also viewed these Databases questions

Question

Describe Table Structures in RDMSs.

Answered: 1 week ago