/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_lstadd_front_bonus.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: kcolin +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/10/21 11:30:38 by kcolin #+# #+# */ /* Updated: 2024/10/21 11:38:08 by kcolin ### ########.fr */ /* */ /* ************************************************************************** */ #include "libft.h" void ft_lstadd_front(t_list **lst, t_list *new) { new->next = *lst; *lst = new; } /* #include #include int main(void) { t_list *list; t_list *new; list = ft_lstnew("Hello There!"); printf("current:\t%p\n", list); printf("content:\t%s\n", (char *)list->content); printf("next:\t\t%p\n", list->next); new = ft_lstnew("New Element!"); ft_lstadd_front(&list, new); printf("current:\t%p\n", list); printf("content:\t%s\n", (char *)list->content); printf("next:\t\t%p\n", list->next); free(list->next); free(list); return (0); } */