-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_lstsize_bonus.c
42 lines (38 loc) · 1.32 KB
/
ft_lstsize_bonus.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstsize.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ldel-val <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/09 17:16:16 by ldel-val #+# #+# */
/* Updated: 2024/10/09 18:30:19 by ldel-val ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
int ft_lstsize(t_list *lst)
{
int node_number;
node_number = 1;
if (!lst)
return (0);
while (lst->next)
{
node_number ++;
lst = lst->next;
}
return (node_number);
}
/*
int main(void)
{
t_list *head;
int content;
content = 42;
head = ft_lstnew(&content);
head->next = ft_lstnew(&content);
head->next->next = ft_lstnew(&content);
head->next->next->next = ft_lstnew(&content);
printf("%d", ft_lstsize(head));
}
*/