C – Strstr

C – Strstr 2017-07-19T23:39:11+00:00

strstr :

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

strstr(str1,str2)  finds the first occurrence of substring str2 in str1.Returns a pointer to the elements in str1 that contain str2, or NULL if str2 does not occur in str1.

C – STRSTR EXAMPLE PROGRAM :

Output :

Before :

str1 : c programming

str2 : Gram

strstr(str1,str2):GramMing

After :

str1 : c programming

str2 : Gram

Prev Next