-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_lstlast.c
executable file
·35 lines (30 loc) · 1.16 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
32
33
34
35
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstlast.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jchoy-me <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/07/19 17:23:41 by jchoy-me #+# #+# */
/* Updated: 2023/07/20 13:25:41 by jchoy-me ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
/*
DESCRIPTION:
Returns the last node of the list.
PARAMETERS:
lst: The beginning of the list.
RETURN VALUE:
Last node of the list.
*/
t_list *ft_lstlast(t_list *lst)
{
if (lst == NULL)
return (NULL);
while (lst->next != NULL)
{
lst = lst->next;
}
return (lst);
}