libft/list/ft_lstlast.c
Raphael 905ffd4b72
refactor: only the usefull header
- Removing all 'libft.h' mention
- Using the include only on the files needed by
2025-09-01 18:45:33 +02:00

29 lines
1.2 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstlast.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rparodi <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/11/12 11:42:54 by rparodi #+# #+# */
/* Updated: 2025/09/01 16:36:47 by rparodi ### ########.fr */
/* */
/* ************************************************************************** */
#include "list.h"
#include <unistd.h>
/**
* @brief Found the last element of the chained list
*
* @param lst the chained list
* @return the last element of the chained list
*/
t_list *ft_lstlast(t_list *lst)
{
if (lst == NULL)
return (lst);
while (lst->next != NULL)
lst = lst->next;
return (lst);
}