lem_in/srcs/lst_ind.c
Tanguy MAZE 7a67b49802 let's go ! B)
added bfs WIP
2019-03-27 18:04:14 +01:00

39 lines
1.2 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* lst_ind.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/03/27 14:56:55 by tmaze #+# #+# */
/* Updated: 2019/03/27 17:45:17 by tmaze ### ########.fr */
/* */
/* ************************************************************************** */
#include "lem_in.h"
t_ind *lst_indadd(t_ind **lst, int ind)
{
t_ind *new;
if ((new = (t_ind*)ft_memalloc(sizeof(t_ind))) != NULL)
{
new->index = ind;
new->next = *lst;
*lst = new;
}
return (new);
}
void lst_inddel(t_ind **lst)
{
t_ind *tmp;
while (*lst != NULL)
{
tmp = *lst;
*lst = (*lst)->next;
ft_memdel((void**)&tmp);
}
}