Mega Code Archive

 
Categories / C / Code Snippets
 

Find substring how to use strstr

#include <stdio.h> #include <string.h> int main () { char str[] ="Hello World"; char *j; j = strstr (str, "is"); strncpy (j, "sample",5 ); puts (str); return 0; }