blob: 8538f5082f92160eb8ebb846be3da232d591e10d (
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_lfind.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/02/10 05:49:19 by cacharle #+# #+# */
/* Updated: 2020/02/10 05:58:19 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft_algo.h"
void *ft_lfind(const void *base, size_t *nelp, size_t width,
t_ftsearch_const *consts)
{
size_t i;
i = 0;
while (i < *nelp)
{
if ((consts->compar)(consts->key, base + i * width) == 0)
return ((void*)base + i * width);
i++;
}
return (NULL);
}
|