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
25void 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}
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...
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
Definition types.h:4
struct s_list * next
Definition types.h:6