-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathft_lstlast.c
More file actions
34 lines (30 loc) · 1.2 KB
/
Copy pathft_lstlast.c
File metadata and controls
34 lines (30 loc) · 1.2 KB
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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstlast.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cado-car <cado-car@student.42sp.org.br> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/07/31 12:06:42 by cado-car #+# #+# */
/* Updated: 2021/07/31 21:55:04 by cado-car ### ########lyon.fr */
/* */
/* ************************************************************************** */
/*
* DESCRIPTION
* Returns the last element of the list.
* PARAMETERS
* #1. The beginning of the list.
* RETURN VALUES
* Last element of the list.
*/
#include "libft.h"
t_list *ft_lstlast(t_list *lst)
{
t_list *temp;
if (lst == NULL)
return (NULL);
temp = lst;
while (temp->next != NULL)
temp = temp->next;
return (temp);
}