-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_lstsize.c
48 lines (44 loc) · 1.57 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
48
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstsize.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: elel-yak <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/10 10:07:22 by elel-yak #+# #+# */
/* Updated: 2022/10/25 20:49:14 by elel-yak ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
int ft_lstsize(t_list *lst)
{
int i;
i = 0;
while (lst)
{
i++;
lst = lst->next;
}
return (i);
}
// int main()
// {
// t_list *head;
// t_list *second;
// t_list *third;
// t_list *fourth;
// head = (t_list *)malloc(sizeof(t_list));
// second = (t_list *)malloc(sizeof(t_list));
// third = (t_list *)malloc(sizeof(t_list));
// fourth = (t_list *)malloc(sizeof(t_list));
// int i = 0;
// head->content = 1;
// head->next = second;
// second->content = 2;
// second->next = third;
// third->content = 3;
// third->next = fourth;
// fourth->content = 4;
// fourth->next = NULL;
// printf("%i\n", ft_lstsize(head));
// }