push_swap/libft/ft_lstadd_back.c
2024-04-20 14:48:16 +02:00

30 lines
1.1 KiB
C
Executable file

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstadd_back.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/02/13 12:07:29 by rparodi #+# #+# */
/* Updated: 2024/03/06 12:15:50 by rparodi ### ########.fr */
/* */
/* ************************************************************************** */
#include "../includes/push_swap.h"
void ft_lstadd_back(t_list **stack, t_list *new)
{
t_list *node;
if (*stack)
{
node = ft_lstlast(*stack);
node->next = new;
new->next = NULL;
}
else
{
*stack = new;
(*stack)->next = NULL;
}
}