codescracker


c

C strchr()



« Previous Chapter Next Function »


strchr()

The strchr() function returns a pointer to the first occurrence of the low-order byte of ch in the string pointed to by str. If no match is found, a null pointer is returned.

strchr() Syntax

Following is the syntax of the strchr() function :

#include<string.h>
char *strchr(const char *str, int ch);

strchr() Example

Following program prints the string is a test :

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

« Previous Chapter Next Function »



Tools
Calculator

Quick Links
Signup - Login - Give Online Test