-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_lstsize.c
47 lines (39 loc) · 1.3 KB
/
ft_lstsize.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
42
43
44
45
46
47
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstsize.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: lpicoli- < lpicoli-@student.42porto.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/11/18 18:27:59 by root #+# #+# */
/* Updated: 2022/11/21 14:03:01 by lpicoli- ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
int ft_lstsize(t_list *lst)
{
int i;
i = 0;
while (lst)
{
lst = lst->next;
i++;
}
return (i);
}
/*int main()
{
t_list *first;
t_list *second;
t_list *third;
int a = 1;
int b = 2;
int c = 3;
first = ft_lstnew(&a);
second = ft_lstnew(&b);
third = ft_lstnew(&c);
first->next = second;
second->next = third;
third->next = NULL;
printf("number of nodes: %d\n", ft_lstsize(first));
}*/