+ 2
C Search & Print linked list
How can i change the Film *find_genres function in order to print only movies which are action and comedy? And how can i change it in order to print every movie, that is action or comedy? https://code.sololearn.com/cHFa1JlxjENk/#c
1 Answer
+ 3
You return a pointer to the first film that is both action and comedy. You then print all the films that follow. Instead, you should create an array of each matching film.
Create a structure with an number of elements used, pointer to next structure, and end with an array of 10 movie pointers.
Allocate and fill in the structure with the first pointer. For each sequential match, add it to the structure. When the first is full, add a second. After completing the seach, return the pointer to the structure.
Add a print_film that displays one element used from both the existing print_filmlist and new print_filmsearch.