Mega Code Archive

 
Categories / C Tutorial / String h
 

Strstr

Item Value Header filestring.h Declarationchar *strstr(const char *str1, const char *str2); FunctionReturns a pointer to the first occurrence of *str2 in *str1 or a null pointer if there str2 is not part of str1. ReturnIt returns a null pointer if no match is found. #include <string.h>   #include <stdio.h>   int main(void)   {     char *p;     p = strstr("this is a test", "is");     printf(p);     return 0;   } is is a test