33 lines
1.2 KiB
C
33 lines
1.2 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_list_at.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2016/08/14 13:18:48 by jhalford #+# #+# */
|
|
/* Updated: 2016/08/18 16:46:36 by jhalford ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include "ft_list.h"
|
|
|
|
t_list *ft_list_at(t_list *begin_list, unsigned int nbr)
|
|
{
|
|
unsigned int i;
|
|
|
|
if (!begin_list)
|
|
return (NULL);
|
|
i = 0;
|
|
while (i < nbr)
|
|
{
|
|
if (begin_list->next)
|
|
begin_list = begin_list->next;
|
|
else
|
|
return (NULL);
|
|
i++;
|
|
}
|
|
return (begin_list);
|
|
}
|