aboutsummaryrefslogtreecommitdiff
path: root/libft/src/lst/ft_lstiter.c
diff options
context:
space:
mode:
Diffstat (limited to 'libft/src/lst/ft_lstiter.c')
-rw-r--r--libft/src/lst/ft_lstiter.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/libft/src/lst/ft_lstiter.c b/libft/src/lst/ft_lstiter.c
new file mode 100644
index 0000000..e46b507
--- /dev/null
+++ b/libft/src/lst/ft_lstiter.c
@@ -0,0 +1,29 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_lstiter.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2019/10/09 09:03:22 by cacharle #+# #+# */
+/* Updated: 2019/11/20 04:01:39 by cacharle ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#include "libft_lst.h"
+
+/*
+** \brief Iterate of list
+** \param f Funtion applied to data of each node
+*/
+
+void ft_lstiter(t_ftlst *lst, void (*f)(void *))
+{
+ if (f == NULL)
+ return ;
+ while (lst != NULL)
+ {
+ (*f)(lst->data);
+ lst = lst->next;
+ }
+}