42_libft/ft_lstsize.c

27 lines
1.0 KiB
C
Raw Normal View History

2022-09-27 11:25:41 -04:00
/* ************************************************************************** */
/* */
/* ::: :::::::: */
2022-10-04 08:21:55 -04:00
/* ft_lstsize.c :+: :+: :+: */
2022-09-27 11:25:41 -04:00
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
2022-10-04 08:21:55 -04:00
/* Created: 2022/09/30 01:18:08 by cchauvet #+# #+# */
/* Updated: 2022/09/30 01:18:15 by cchauvet ### ########.fr */
2022-09-27 11:25:41 -04:00
/* */
/* ************************************************************************** */
#include "libft.h"
2022-10-04 08:21:55 -04:00
int ft_lstsize(t_list *lst)
2022-09-27 11:25:41 -04:00
{
2022-10-04 08:21:55 -04:00
int count;
2022-09-27 11:25:41 -04:00
2022-10-04 08:21:55 -04:00
count = 0;
while (lst != NULL)
{
count++;
lst = lst->next;
}
return (count);
2022-09-27 11:25:41 -04:00
}