add print stacks function

This commit is contained in:
David Gailleton
2025-12-09 13:38:10 +01:00
parent ad4275c206
commit c781d6f5cd
5 changed files with 101 additions and 23 deletions

View File

@@ -6,7 +6,7 @@
/* By: mteriier <mteriier@student.42lyon.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/12/09 11:56:23 by mteriier #+# #+# */
/* Updated: 2025/12/09 12:43:09 by mteriier ### ########lyon.fr */
/* Updated: 2025/12/09 13:19:39 by dgaillet ### ########lyon.fr */
/* */
/* ************************************************************************** */

View File

@@ -1,30 +0,0 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* stack_len.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mteriier <mteriier@student.42lyon.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/12/09 12:05:15 by mteriier #+# #+# */
/* Updated: 2025/12/09 12:07:29 by mteriier ### ########lyon.fr */
/* */
/* ************************************************************************** */
#include "push_swap.h"
int stack_len(t_stack *stack)
{
t_stack *first;
int i;
first = stack;
if (!stack)
return (0);
i = 1;
while (stack->next != first)
{
stack = stack->next;
i++;
}
return (i);
}