Libft
42 Libft library documentation
Loading...
Searching...
No Matches
ft_lstdelone.c File Reference
#include <stdlib.h>
#include "../includes/types.h"
+ Include dependency graph for ft_lstdelone.c:

Go to the source code of this file.

Functions

void ft_lstdelone (t_list *lst, void(*del)(void *))
 Deletes and frees a single element from a linked list. This function takes an element from a linked list and a function pointer to a deletion function, then removes and frees the element.
 

Function Documentation

◆ ft_lstdelone()

void ft_lstdelone ( t_list lst,
void(*)(void *)  del 
)

Deletes and frees a single element from a linked list. This function takes an element from a linked list and a function pointer to a deletion function, then removes and frees the element.

Parameters
lstThe element to delete and free.
delA function pointer to the deletion function.

Definition at line 24 of file ft_lstdelone.c.

25{
26 if (!lst || !del)
27 return ;
28 del(lst->content);
29 free(lst);
30}
void * content
Definition types.h:5

References s_list::content.

Referenced by ft_lstclear().

+ Here is the caller graph for this function: