const char * strstr ( const char * str1, const char * str2 ); char * strstr ( char * str1, const char * str2 );
char * strstr ( const char *, const char * );
1234567891011121314
/* strstr example */ #include <stdio.h> #include <string.h> int main () { char str[] ="This is a simple string"; char * pch; pch = strstr (str,"simple"); if (pch != NULL) strncpy (pch,"sample",6); puts (str); return 0; }
This is a sample string