-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_lstinsert.c
29 lines (26 loc) · 1.08 KB
/
ft_lstinsert.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstinsert.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rnbou <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/10/17 13:06:24 by rnbou #+# #+# */
/* Updated: 2018/10/17 16:43:00 by rnbou ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_lstinsert(t_list **lst, t_list *ins, size_t n)
{
size_t i;
t_list *k;
i = 0;
k = *lst;
while ((k) && i < n - 1)
{
k = k->next;
i++;
}
ins->next = k->next;
k->next = ins;
}