aboutsummaryrefslogtreecommitdiff
path: root/c12/ex04/ft_list_push_back.c
blob: db4fdb08c7174f1c5adfbfcfa13227750287e769 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   ft_list_push_back.c                                :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: cacharle <charles.cabergs@gmail.com>       +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2019/07/09 17:18:46 by cacharle          #+#    #+#             */
/*   Updated: 2019/07/17 18:04:28 by cacharle         ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

#include "ft_list.h"

void ft_list_push_back(t_list **begin_list, void *data)
{
	t_list	*new_rear;

	new_rear = ft_create_elem(data);
	if (!*begin_list)
	{
		(*begin_list) = new_rear;
		return ;
	}
	while ((*begin_list)->next)
		*begin_list = (*begin_list)->next;
	(*begin_list)->next = new_rear;
}