maxishell
Implementation of a shell for Linux-like systems
Loading...
Searching...
No Matches
ft_memchr.c File Reference
#include "libft.h"
Include dependency graph for ft_memchr.c:

Go to the source code of this file.

Functions

void * ft_memchr (const void *s, int c, size_t n)
 

Function Documentation

◆ ft_memchr()

void * ft_memchr ( const void *  s,
int  c,
size_t  n 
)

Definition at line 29 of file ft_memchr.c.

30{
31 const unsigned char *st;
32 unsigned char ct;
33
34 st = s;
35 ct = (unsigned char)c;
36 while (n--)
37 {
38 if (*st == ct)
39 return ((void *)st);
40 st++;
41 }
42 return (NULL);
43}