-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_dlstadd_back.c
31 lines (27 loc) · 1.18 KB
/
ft_dlstadd_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
/* ************************************************************************** */
/* */
/* :::::::: */
/* ft_dlstadd_back.c :+: :+: */
/* +:+ */
/* By: jaberkro <[email protected]> +#+ */
/* +#+ */
/* Created: 2022/02/24 12:55:19 by jaberkro #+# #+# */
/* Updated: 2022/04/14 12:25:08 by jaberkro ######## odam.nl */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_dlstadd_back(t_dlist **dlst, t_dlist *new)
{
t_dlist *tmp;
if (*dlst == NULL)
*dlst = new;
else
{
tmp = *dlst;
while (tmp->next != NULL)
tmp = tmp->next;
new->previous = tmp;
tmp->next = new;
}
}
/* Adds the element ’new’ at the end of the doubly linked list. */