-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_lstidel.c
34 lines (31 loc) · 1.13 KB
/
ft_lstidel.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstidel.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rnbou <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/10/17 13:27:17 by rnbou #+# #+# */
/* Updated: 2018/10/17 16:33:42 by rnbou ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_lstidel(t_list **lst, size_t n)
{
size_t i;
t_list *k;
t_list *p;
i = 0;
k = *lst;
while ((k) && i < n - 1)
{
p = k;
k = k->next;
i++;
}
p->next = k->next;
free(k->content);
k->content_size = 0;
k->next = NULL;
free(k);
}