mirror of
https://github.com/Ladebeze66/libft.git
synced 2025-12-13 04:36:55 +01:00
28 lines
1.1 KiB
C
Executable File
28 lines
1.1 KiB
C
Executable File
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_memchr.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: fgras-ca <marvin@42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2023/02/10 13:42:10 by fgras-ca #+# #+# */
|
|
/* Updated: 2023/02/14 13:03:28 by fgras-ca ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "libft.h"
|
|
|
|
void *ft_memchr(const void *s, int c, size_t n)
|
|
{
|
|
size_t i;
|
|
|
|
i = 0;
|
|
while (i < n)
|
|
{
|
|
if (((unsigned char *)s)[i] == (unsigned char)c)
|
|
return ((void *)(s + i));
|
|
i++;
|
|
}
|
|
return (0);
|
|
}
|