-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_lstsize.c
33 lines (30 loc) · 1.12 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstsize.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adpachec <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/09/26 17:54:09 by adpachec #+# #+# */
/* Updated: 2022/09/28 12:58:22 by adpachec ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
int ft_lstsize(t_list *lst)
{
int len;
t_list *temp;
len = 0;
if (!lst)
return (0);
if (lst->next == NULL)
return (1);
temp = lst;
while (temp->next != NULL)
{
++len;
temp = temp->next;
}
++len;
return (len);
}