C strstr()

The strstr() function returns a pointer to the first occurrence in the string pointed to by str1 of the string pointed to by str2. It returns a null pointer if no match is found.

strstr() Syntax

Following is the syntax of the strstr() function :

char *strstr(const char *str1, const char *str2);

strstr() Example

Following program displays the message is is a test :

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

C Online Test

« Previous Chapter Next Function »

Like/Share Us on Facebook 😋