/*************************************************
* example of strstr():
* replace "simple " to "sample" *
* *
* *
* *
* ************************************************/
#include<string.h> #include<stdio.h>
int main() { char str[]="This is a simple example! "; char*ptr;
ptr =strstr( str,"simple"); //strcpy( ptr , "sample" );//wrong; strcpy() including the null terminate character: the result is "This is a simple"