// CPP program to illustrate strstr()
int main()
{
// Take two in variable str1 and str2
char str1[] = "C is programming";
char str2[] = "is";
char* p;
// Here Find first occurrence of str2 in str1
p = strstr(str1, str2);
// Prints the result
if (p) {
strcpy(p, "Strings");
printf("%s", str1);
} else
printf("String not found\n");
return 0;
}
|