-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_lstsize_bonus.c
56 lines (50 loc) · 1.42 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstsize_bonus.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: azaghlou <azaghlou@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/23 15:41:58 by azaghlou #+# #+# */
/* Updated: 2022/10/25 02:39:32 by azaghlou ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
int ft_lstsize(t_list *lst)
{
int i;
t_list *t;
i = 0;
t = lst;
while (t)
{
t = t->next;
i++;
}
return (i);
}
/*
int main(void)
{
int i;
t_list *s;
t_list *t;
char ss;
t_list *str;
ss = 'a';
i = 0;
s = ft_lstnew("amine");
t = s;
str = ft_lstnew("ee");
str->next = ft_lstnew("aa");
str->next->next = ft_lstnew("ss");
str->next->next->next = ft_lstnew("dd");
printf("%d", ft_lstsize(str));
}*/
// while (i < 5)
// {
// t->content = ft_lstnew(ss);
// t = t->next;
// ss = ss + 1;
// i++;
// }