
Implement a function that walks a singly linked list and discards every node whose payload matches a reference value, freeing the removed nodes as it goes.
list_filter(&head, &target, eq) where eq returns 0 on matchevery node whose data equals *target is unlinked and freedlist_filter(&head, &target, eq) with head == NULLno-op, head stays NULLlist_filter.cfree<stdlib.h>declares free<stddef.h>defines NULL
Run the tests to grade your code
Implement a function that walks a singly linked list and discards every node whose payload matches a reference value, freeing the removed nodes as it goes.
list_filter(&head, &target, eq) where eq returns 0 on matchevery node whose data equals *target is unlinked and freedlist_filter(&head, &target, eq) with head == NULLno-op, head stays NULLlist_filter.cfree<stdlib.h>declares free<stddef.h>defines NULL
Run the tests to grade your code
Memory will appear here