change fonctions pour list avec nouvelles fonctions pour listes a deux sens

This commit is contained in:
hugogogo
2022-03-24 16:49:59 +01:00
parent bc53060626
commit 60af4e44b0
27 changed files with 484 additions and 13 deletions

30
srcs/ft_lstloop_back.c Normal file
View File

@@ -0,0 +1,30 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstloop_back.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: simplonco <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/03/24 15:01:37 by simplonco #+# #+# */
/* Updated: 2022/03/24 15:02:02 by simplonco ### ########.fr */
/* */
/* ************************************************************************** */
/*
* go backward through all elements of a two-way list
* and apply the function f to each of them
*/
#include "libft.h"
void ft_lstloop_back(t_list *lst, void (*f)(void *))
{
if (!f)
return ;
while (lst)
{
f(lst->content);
lst = lst->prev;
}
}