-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_lstdelone.c
34 lines (31 loc) · 1.32 KB
/
ft_lstdelone.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstdelone.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: edegraev <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/11/12 18:43:07 by edegraev #+# #+# */
/* Updated: 2023/11/13 15:27:12 by edegraev ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_lstdelone(t_list *lst, void (*del)(void*))
{
if (!lst || !del)
return ;
del(lst->content);
free(lst);
}
// #include <stdio.h>
// int main(void)
// {
// t_list *lst;
// lst = ft_lstnew("Hello");
// ft_lstadd_front(&lst, ft_lstnew("World"));
// ft_lstadd_front(&lst, ft_lstnew("!"));
// ft_lstdelone(lst, free);
// char *str = ft_lstlast(lst)->content;
// printf("%s\n", str);
// return (0);
// }