-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_lstiter_bonus.c
30 lines (27 loc) · 1.16 KB
/
ft_lstiter_bonus.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstiter_bonus.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: edetoh <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/22 11:21:16 by edetoh #+# #+# */
/* Updated: 2024/10/25 11:12:54 by edetoh ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
/*
ft_lstiter applies function 'f' to each element of 'lst'.
Takes 'lst' (linked list) and 'f' (function to apply).
Returns nothing.
*/
void ft_lstiter(t_list *lst, void (*f)(void *))
{
if (!lst || !f)
return ;
while (lst)
{
f(lst->content);
lst = lst->next;
}
}