welibc
A clear, secure, and well documented standard C library
Functions
memchr.c File Reference

Defines the memchr function. More...

#include <string.h>
Include dependency graph for memchr.c:

Go to the source code of this file.

Functions

void * memchr (const void *s, int c, size_t n)
 Searches for a given character. More...
 

Detailed Description

Defines the memchr function.

Definition in file memchr.c.

Function Documentation

◆ memchr()

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

Searches for a given character.

Parameters
*sObject being searched
cCharacter to find
nMaximum number of character to search

The memchr function locates the first occurrence of c (converted to an unsigned char) in the initial n characters (each interpreted as unsigned char) of the object pointed to by s.

Returns
A pointer to the located character
Return values
NULLThe character does not occur in the object

Definition at line 54 of file memchr.c.

References NULL.