codescracker


c

C memchr()



« Previous Chapter Next Function »


memchr()

The memchr() function searches the array pointed to by buffer for the first occurrence of ch in the first count characters.

The memchr() function returns a pointer to the first occurrence of ch in buffer, or it returns a null pointer if ch is not found.

memchr() Syntax

Following is the syntax of the memchr() function :

#include<string.h>
void *memchr(const void *buffer, int ch, size_t count);

memchr() Example

Following program prints is a test on the screen :

#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
	clrscr();
	char *p;
	p = memchr("this is a test", ' ', 14);
	printf(p);
	getch();
}

« Previous Chapter Next Function »



Tools
Calculator

Quick Links
Signup - Login - Give Online Test