tgrekov-libft
HIVE libft Oct 2023
Loading...
Searching...
No Matches
ft_lstadd_back_bonus.c
Go to the documentation of this file.
1/* ************************************************************************** */
2/* */
3/* ::: :::::::: */
4/* ft_lstadd_back_bonus.c :+: :+: :+: */
5/* +:+ +:+ +:+ */
6/* By: tgrekov <tgrekov@student.hive.fi> +#+ +:+ +#+ */
7/* +#+#+#+#+#+ +#+ */
8/* Created: 2023/10/28 01:25:47 by tgrekov #+# #+# */
9/* Updated: 2023/11/04 22:24:36 by tgrekov ### ########.fr */
10/* */
11/* ************************************************************************** */
12
20#include "libft.h"
21
35void ft_lstadd_back(t_list **lst, t_list *new)
36{
37 if (!lst)
38 return ;
39 if (*lst)
40 ft_lstlast(*lst)->next = new;
41 else
42 *lst = new;
43}
void ft_lstadd_back(t_list **lst, t_list *new)
Adds node at pointer new to the end of the list starting at pointer pointed to by lst.
t_list * ft_lstlast(t_list *lst)
Get the last node in a list.
Linked list node.
Definition libft.h:44
struct s_list * next
Pointer to the next node.
Definition libft.h:46