-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_lstlast.c
34 lines (32 loc) · 1.18 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
27
28
29
30
31
32
33
34
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstlast.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: akdemir <[email protected] +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/07/09 20:41:47 by akdemir #+# #+# */
/* Updated: 2023/07/19 16:46:39 by akdemir ### ########.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()
{
t_list *l1;
t_list *l2;
t_list *l2;
l1=ft_lstnew("a");
l2=ft_lstnew("z");
l3=ft_lstnew("c");
l1->next=l2;
ft_lstlast(l3);
printf("%s",l1->next->content);
}