-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_lstadd_back.c
41 lines (39 loc) · 1.5 KB
/
ft_lstadd_back.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
36
37
38
39
40
41
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstadd_back.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jamendoe <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/11/13 13:26:52 by jamendoe #+# #+# */
/* Updated: 2022/11/13 13:26:56 by jamendoe ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_lstadd_back(t_list **lst, t_list *new)
{
t_list *addback;
addback = *lst;
if (!new)
(*lst) = NULL;
else if (!(*lst))
(*lst) = new;
else
{
while (addback->next)
addback = addback->next;
addback->next = new;
}
}
/*
Function name ft_lstadd_back
Prototype void ft_lstadd_back(t_list **lst, t_list *new);
Turn in files -
Parameters lst: The address of a pointer to the first link of
a list.
new: The address of a pointer to the node to be
added to the list.
Return value None
External functs. None
Description Adds the node ’new’ at the end of the list.
*/