summaryrefslogtreecommitdiff
path: root/libft/ft_lstlast.c
diff options
context:
space:
mode:
Diffstat (limited to 'libft/ft_lstlast.c')
-rw-r--r--libft/ft_lstlast.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/libft/ft_lstlast.c b/libft/ft_lstlast.c
new file mode 100644
index 0000000..926b5d3
--- /dev/null
+++ b/libft/ft_lstlast.c
@@ -0,0 +1,22 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_lstlast.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: kdx <kdx @student.42angouleme.fr +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2022/09/29 03:02:22 by kdx #+# #+# */
+/* Updated: 2022/09/29 03:03:20 by kdx ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#include "libft.h"
+
+t_list *ft_lstlast(t_list *lst)
+{
+ if (lst == NULL)
+ return (NULL);
+ while (lst->next != NULL)
+ lst = lst->next;
+ return (lst);
+}