-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_lstlast.c
31 lines (29 loc) · 1.14 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstlast.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mmalie <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/11/07 10:01:10 by mmalie #+# #+# */
/* Updated: 2024/11/14 09:30:10 by mmalie ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
/*
* Returns the last node in a linked list.
*/
t_list *ft_lstlast(t_list *lst)
{
t_list *last_node;
if (lst == NULL)
{
return (NULL);
}
last_node = lst;
while (last_node->next != NULL)
{
last_node = last_node->next;
}
return (last_node);
}