forked from josanri/Libft_extended
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_lstiter.c
31 lines (29 loc) · 1.23 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstiter.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: aalvarez <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/08/17 22:56:16 by aalvarez #+# #+# */
/* Updated: 2022/08/17 23:10:44 by aalvarez ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
/**
* @brief iterates over a list and applies the function pointed by f to every
* node's content.
*
* @param lst the starting node to iterate.
* @param f the function to be applied to every node's content.
*/
void ft_lstiter(t_list *lst, void (*f)(void *))
{
if (!lst)
return ;
while (lst)
{
f(lst->content);
lst = lst->next;
}
}