codescracker


c

C strstr()



« Previous Chapter Next Function »


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 :

#include<string.h>
char *strstr(const char *str1, const char *str2);

strstr() Example

Following program displays the message is is a test :

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

« Previous Chapter Next Function »



Tools
Calculator

Quick Links
Signup - Login - Give Online Test