-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_lstlast_bonus.c
38 lines (35 loc) · 1.3 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
34
35
36
37
38
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstlast_bonus.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: acalin-b <[email protected] +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/03/25 16:26:02 by acalin-b #+# #+# */
/* Updated: 2023/03/25 16:29:41 by acalin-b ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
#include <stdlib.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 *new;
// t_list *new2;
// t_list *new3;
//
// new = ft_lstnew("Hello");
// new2 = ft_lstnew("World");
// new3 = ft_lstnew("!");
// ft_lstadd_front(&new, new2);
// ft_lstadd_front(&new, new3);
// printf("%s", ft_lstlast(new)->content);
// return (0);
//}