-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_lstsize.c
More file actions
31 lines (28 loc) · 1.08 KB
/
ft_lstsize.c
File metadata and controls
31 lines (28 loc) · 1.08 KB
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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstsize.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: maceccar <maceccar@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/11/10 15:40:45 by maceccar #+# #+# */
/* Updated: 2023/11/10 15:40:45 by maceccar ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
int ft_lstsize(t_list *lst)
{
t_list *i;
int j;
j = 1;
i = malloc(sizeof(t_list));
if (!i || !lst)
return (0);
*i = *lst;
while (i->next)
{
*i = *i->next;
j++;
}
return (j);
}