Libft
42 Libft library documentation
Loading...
Searching...
No Matches
ft_lstadd_back.c
Go to the documentation of this file.
1
/* ************************************************************************** */
2
/* */
3
/* ::: :::::::: */
4
/* ft_lstadd_back.c :+: :+: :+: */
5
/* +:+ +:+ +:+ */
6
/* By: raphalme <raphalme@student.42.fr> +#+ +:+ +#+ */
7
/* +#+#+#+#+#+ +#+ */
8
/* Created: 2025/12/29 19:19:00 by raphalme #+# #+# */
9
/* Updated: 2026/04/14 10:36:21 by raphalme ### ########.fr */
10
/* */
11
/* ************************************************************************** */
12
13
#include "../includes/libft.h"
14
#include "../includes/types.h"
15
25
void
ft_lstadd_back
(
t_list
**lst,
t_list
*
new
)
26
{
27
t_list
*last;
28
29
if
(!lst || !
new
)
30
return ;
31
if
(!*lst)
32
{
33
*lst =
new
;
34
return ;
35
}
36
last =
ft_lstlast
(*lst);
37
last->
next
=
new
;
38
}
ft_lstadd_back
void ft_lstadd_back(t_list **lst, t_list *new)
Adds a new element to the end of a linked list. This function takes a pointer to the first element of...
Definition
ft_lstadd_back.c:25
ft_lstlast
t_list * ft_lstlast(t_list *lst)
Returns the last element of a linked list. This function takes a linked list and returns a pointer to...
Definition
ft_lstlast.c:23
s_list
Definition
types.h:4
s_list::next
struct s_list * next
Definition
types.h:6
src
ft_lstadd_back.c
Generated by
1.9.8