-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_lstiter.c
39 lines (35 loc) · 1.37 KB
/
ft_lstiter.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
35
36
37
38
39
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstiter.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: edegraev <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/11/14 09:58:57 by edegraev #+# #+# */
/* Updated: 2023/11/14 10:08:47 by edegraev ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_lstiter(t_list *lst, void (*f)(void *))
{
if (lst == NULL || f == NULL)
return ;
while (lst)
{
f(lst->content);
lst = lst->next;
}
}
// #include <stdio.h>
// void my_function(void *content)
// {
// printf("%s\n", (char*)content);
// }
// int main()
// {
// t_list *my_list = ft_lstnew("Hello");
// ft_lstadd_back(&my_list, ft_lstnew("World"));
// ft_lstadd_back(&my_list, ft_lstnew("Linda"));
// ft_lstiter(my_list, my_function);
// return 0;
// }