-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_lstsize_bonus.c
46 lines (42 loc) · 1.43 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstsize_bonus.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tcakir-y <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/18 11:31:06 by tcakir-y #+# #+# */
/* Updated: 2024/10/18 11:50:18 by tcakir-y ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
int ft_lstsize(t_list *lst)
{
int size;
t_list *temp;
size = 0;
temp = lst;
while (temp != NULL)
{
size++;
temp = temp -> next;
}
return (size);
}
//static void print_list(t_list *list)
//{
// while (list != NULL)
// {
// printf("%s -> ", (char *)list -> content);
// list = list -> next;
// }
//}
//int main(void)
//{
// t_list *list = ft_lstnew(" !!");
// ft_lstadd_front(&list, ft_lstnew(" world"));
// ft_lstadd_front(&list, ft_lstnew("hello"));
// printf("size is %d\n", ft_lstsize(list));
// print_list(list);
// return (0);
//}