ft_lstlast.c 194 B

123456789101112131415
  1. #include "libft.h"
  2. t_list *ft_lstlast(t_list *lst)
  3. {
  4. if (lst == NULL)
  5. return (NULL);
  6. while (lst != NULL)
  7. {
  8. if (lst->next == NULL)
  9. return (lst);
  10. lst = lst->next;
  11. }
  12. return (lst);
  13. }