1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#include <stdlib.h> #include "libft.h" void ft_lstadd_back(t_list **alst, t_list *new) { t_list *cursor; if (*alst == NULL) { *alst = new; return ; } cursor = *alst; while (cursor->next != NULL) cursor = cursor->next; cursor->next = new; }