aboutsummaryrefslogtreecommitdiff
path: root/ft_lstadd_back.c
blob: e2cbf2aa6449a0e26cfc8127c69fba726b52b5c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <stdlib.h>
#include "libft.h"

void    ft_lstadd_back(t_list **alst, t_list *new)
{
    t_list  *cursor;

    if (*alst == NULL)
    {
        *alst = new;
        return ;
    }
    cursor = *alst;
    while (cursor->next != NULL)
        cursor = cursor->next;
    cursor->next = new;
}