-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_lst.c
More file actions
43 lines (38 loc) · 1.21 KB
/
ft_lst.c
File metadata and controls
43 lines (38 loc) · 1.21 KB
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
42
43
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lst.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: hchairi <hchairi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/04/27 14:36:25 by hchairi #+# #+# */
/* Updated: 2023/07/30 14:19:49 by hchairi ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void lstclear(t_list *node)
{
t_list *tmp;
t_list *tmp_next;
if (!node)
return ;
tmp = node;
while (tmp)
{
tmp_next = tmp->next;
free (tmp);
tmp = tmp_next;
}
node = NULL;
}
int ft_lstsize(t_list *lst)
{
int count;
count = 0;
while (lst != NULL)
{
count++;
lst = lst->next;
}
return (count);
}