-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathft_lstlast.c
30 lines (27 loc) · 1.12 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstlast.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: apuchill <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/02/07 16:44:34 by apuchill #+# #+# */
/* Updated: 2020/02/19 14:04:15 by apuchill ### ########.fr */
/* */
/* ************************************************************************** */
/*
** LIBRARY: N/A
** SYNOPSIS: find last element of list
**
** DESCRIPTION:
** Returns the last element of the list.
*/
#include "libft.h"
t_list *ft_lstlast(t_list *lst)
{
if (!lst)
return (0);
while (lst->next)
lst = lst->next;
return (lst);
}