C 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 :

char *strchr(const char *str, int ch);

strchr() Example

Following program prints the string is a test :

void main()
	char *p;
	p = strchr("this is a test", ' ');

C Online Test

« Previous Chapter Next Function »