piscine/c12/ex13/ft_list_merge.c
Willem Haffmans 607ce08c18 all
2024-09-10 00:18:01 +02:00

31 lines
1.2 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_list_merge.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: whaffman <whaffman@student.codam.nl> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/07/03 18:57:03 by whaffman #+# #+# */
/* Updated: 2024/07/03 19:11:03 by whaffman ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_list.h"
void ft_list_merge(t_list **begin_list1, t_list *begin_list2)
{
t_list *curr;
if (!begin_list2)
return ;
if (!*begin_list1)
{
*begin_list1 = begin_list2;
return ;
}
curr = *begin_list1;
while (curr->next)
curr = curr->next;
curr->next = begin_list2;
}