-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_lstlast_bonus.c
33 lines (29 loc) · 1.24 KB
/
ft_lstlast_bonus.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
27
28
29
30
31
32
33
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstlast_bonus.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: azaghlou <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/23 17:18:15 by azaghlou #+# #+# */
/* Updated: 2022/10/27 21:47:19 by azaghlou ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
t_list *ft_lstlast(t_list *lst)
{
if (!lst)
return (NULL);
while (lst->next)
lst = lst->next;
return (lst);
}
// int main(void)
// {
// t_list *str;
// str = ft_lstnew("ee");
// str->next = ft_lstnew("aa");
// str->next->next = ft_lstnew("ss");
// str->next->next->next = ft_lstnew("dd");
// printf("%s \n", ft_lstlast(str)->content);
// }