-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_lstlast_bonus.c
32 lines (29 loc) · 1.1 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstlast_bonus.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: abkssiba <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/10/22 13:02:16 by abkssiba #+# #+# */
/* Updated: 2019/10/29 11:21:42 by abkssiba ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
t_list *ft_lstlast(t_list *lst)
{
int i;
int len;
t_list *last;
if (!lst)
return (NULL);
len = ft_lstsize(lst);
i = 0;
while (i < len - 1)
{
lst = lst->next;
i++;
}
last = lst;
return (last);
}