-
Notifications
You must be signed in to change notification settings - Fork 1
/
ft_lstlast.c
executable file
·26 lines (24 loc) · 1.08 KB
/
ft_lstlast.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstlast.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rel-fila <rel-fila@student.1337.ma> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/21 12:41:29 by rel-fila #+# #+# */
/* Updated: 2022/10/21 12:42:10 by rel-fila ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
t_list *ft_lstlast(t_list *lst)
{
if (lst == NULL)
return (0);
while (lst)
{
if (lst ->next == NULL)
return (lst);
lst = lst ->next;
}
return (lst);
}