I am doing a C exercise where we are given prototypes, and we have to turn them into functions. I stumbled onto the following prototype:
void ft_lstdelone(t_list *lst, void (*del)(void*))
This function is supposed to delete a node from a linked list, but I don't understand what is happening in the second argument "void (*del)(void*)".
The description of the exercise has:
- Parameters -
- #1 The element to free.
- #2 The address of the function used to delete the content.
- Description - Takes as a parameter an element and frees the memory of the element’s content using the function ’del’ given as a parameter and free the element. The memory of ’next’ must not be freed.
I take from this that I have to use a function as an argument, but it doesn't make any sense.
Can someone help me unwrap what this means?