C Search & Print linked list | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 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

5th Jul 2019, 8:26 PM
Maxim Schiffmann
Maxim Schiffmann - avatar
1 Resposta
+ 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.
6th Jul 2019, 9:01 PM
John Wells
John Wells - avatar