29 lines
1.1 KiB
C
Executable file
29 lines
1.1 KiB
C
Executable file
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_lstsize_bonus.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: thrieg <thrieg@student.42mulhouse.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2024/10/16 12:13:44 by thrieg #+# #+# */
|
|
/* Updated: 2025/02/16 19:04:03 by thrieg ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "libft.h"
|
|
|
|
//returns 0 if lst is NULL
|
|
int ft_lstsize(t_list *lst)
|
|
{
|
|
int i;
|
|
|
|
if (!lst)
|
|
return (0);
|
|
i = 1;
|
|
while (lst->next)
|
|
{
|
|
i++;
|
|
lst = lst->next;
|
|
}
|
|
return (i);
|
|
}
|