Question 9 · 10 points
Generic linked-list filter
Implement filter_list so that nodes for which keep returns 0 are removed. Nodes kept must remain in their original order.
typedef struct node {
void *data;
struct node *next;
} node_t;
void filter_list(
node_t **head,
int (*keep)(const void *),
void (*destroy)(void *)
);
For every removed node, call destroy on its data, free the node, and correctly update *head when the first node is removed.