42/d11/ex11/ft_list_find.c

25 lines
1.1 KiB
C
Raw Permalink Normal View History

2016-11-20 02:20:23 +02:00
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_list_find.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gtertysh <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/09 21:18:19 by gtertysh #+# #+# */
/* Updated: 2016/11/09 21:46:18 by gtertysh ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_list.h"
t_list *ft_list_find(t_list *begin_list, void *data_ref, int (*cmp)())
{
while (begin_list)
{
if ((cmp(begin_list->data, data_ref) == 0))
return (begin_list);
begin_list = begin_list->next;
}
return (0);
}