42/d11/ex07/ft_list_at.c

31 lines
1.1 KiB
C
Raw Permalink Normal View History

2016-11-20 02:20:23 +02:00
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_list_at.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gtertysh <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/09 15:31:04 by gtertysh #+# #+# */
/* Updated: 2016/11/09 16:27:44 by gtertysh ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_list.h"
#include <stdlib.h>
t_list *ft_list_at(t_list *begin_list, unsigned int nbr)
{
unsigned int i;
t_list *temp;
i = 0;
temp = begin_list;
while (i < nbr && begin_list != NULL)
{
temp = begin_list->next;
begin_list = temp;
i++;
}
return (temp);
}