mirror of
https://codeberg.org/la-chouette/minishell.git
synced 2025-12-06 07:28:09 +01:00
29 lines
1.1 KiB
C
29 lines
1.1 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_lstsize_bonus.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: jguelen <marvin@42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2024/10/21 13:54:34 by jguelen #+# #+# */
|
|
/* Updated: 2024/10/23 16:33:32 by jguelen ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "libft.h"
|
|
|
|
/*Presumes the linked list not to be circular*/
|
|
int ft_lstsize(t_list *lst)
|
|
{
|
|
int len;
|
|
|
|
len = 1;
|
|
if (lst == NULL)
|
|
return (0);
|
|
while (lst->next)
|
|
{
|
|
len++;
|
|
lst = lst->next;
|
|
}
|
|
return (len);
|
|
}
|