-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_lstlast.c
25 lines (23 loc) · 1.13 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstlast.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: arepsa <arepsa@student.42porto.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/04/23 13:14:34 by arepsa #+# #+# */
/* Updated: 2023/04/26 14:41:01 by arepsa ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
/*Return the last node of the list.*/
/*lst - head(beginning) of the list*/
/*if the next is pointing to NULL, return this node*/
t_list *ft_lstlast(t_list *lst)
{
if (!lst)
return (NULL);
while (lst->next)
lst = lst->next;
return (lst);
}