lst_at from piscine d11

This commit is contained in:
Jack Halford 2016-12-12 18:12:37 +01:00
parent 78390e5d8c
commit 66e8156235
9 changed files with 39 additions and 8 deletions

View file

@ -6,13 +6,15 @@
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */ /* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/07 13:27:46 by jhalford #+# #+# */ /* Created: 2016/11/07 13:27:46 by jhalford #+# #+# */
/* Updated: 2016/12/07 16:54:25 by jhalford ### ########.fr */ /* Updated: 2016/12/12 14:59:12 by jhalford ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#ifndef LST_H #ifndef LST_H
# define LST_H # define LST_H
# include "libft.h"
struct s_list struct s_list
{ {
void *content; void *content;
@ -73,5 +75,6 @@ void ft_lst_reverse(t_list **begin_list);
int ft_diff(void *a, void *b); int ft_diff(void *a, void *b);
t_list *ft_id(t_list *a); t_list *ft_id(t_list *a);
t_list *ft_lst_at(t_list *list, unsigned int nbr);
#endif #endif

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */ /* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/27 11:35:18 by jhalford #+# #+# */ /* Created: 2016/11/27 11:35:18 by jhalford #+# #+# */
/* Updated: 2016/12/03 12:16:59 by jhalford ### ########.fr */ /* Updated: 2016/12/12 11:54:49 by jhalford ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */ /* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/25 13:53:46 by jhalford #+# #+# */ /* Created: 2016/11/25 13:53:46 by jhalford #+# #+# */
/* Updated: 2016/12/03 12:16:38 by jhalford ### ########.fr */ /* Updated: 2016/12/12 11:55:03 by jhalford ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */ /* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/07 13:33:27 by jhalford #+# #+# */ /* Created: 2016/11/07 13:33:27 by jhalford #+# #+# */
/* Updated: 2016/12/10 16:50:26 by jhalford ### ########.fr */ /* Updated: 2016/12/12 11:57:28 by jhalford ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

View file

@ -0,0 +1,28 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_list_at.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/08/14 13:18:48 by jhalford #+# #+# */
/* Updated: 2016/12/12 14:58:37 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
#include "lst.h"
t_list *ft_lst_at(t_list *list, unsigned int nbr)
{
unsigned int i;
if (!list)
return (NULL);
i = 0;
while (i < nbr && list)
{
list = list->next;
i++;
}
return (list);
}

View file

@ -6,7 +6,7 @@
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */ /* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/04 11:09:12 by jhalford #+# #+# */ /* Created: 2016/11/04 11:09:12 by jhalford #+# #+# */
/* Updated: 2016/12/05 13:39:09 by jhalford ### ########.fr */ /* Updated: 2016/12/12 12:40:15 by jhalford ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */ /* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/04 11:09:20 by jhalford #+# #+# */ /* Created: 2016/11/04 11:09:20 by jhalford #+# #+# */
/* Updated: 2016/11/04 11:09:20 by jhalford ### ########.fr */ /* Updated: 2016/12/12 12:54:45 by jhalford ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */ /* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/03 14:57:19 by jhalford #+# #+# */ /* Created: 2016/11/03 14:57:19 by jhalford #+# #+# */
/* Updated: 2016/11/03 14:57:19 by jhalford ### ########.fr */ /* Updated: 2016/12/12 13:31:59 by jhalford ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */ /* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/03 14:57:21 by jhalford #+# #+# */ /* Created: 2016/11/03 14:57:21 by jhalford #+# #+# */
/* Updated: 2016/11/04 13:11:19 by jhalford ### ########.fr */ /* Updated: 2016/12/12 13:04:00 by jhalford ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */