// strstr example // locate substring // source: http://www.cplusplus.com/ #include #include #include int main() { char str[] ="This is a simple string\n"; char *pch; fputs(str, stdout); pch = strstr(str, "simple"); strncpy (pch,"sample", 6); fputs(str, stdout); return EXIT_SUCCESS; }