Here i'm trying to replace the word "how are you" in string array 's' by "woo". But it is exiting abruptly during the runtime . please help
char *s[] = {"hi there","how are you","Fine Ok!"};
char str1[4] = "how" ;char str2[4] = "woo";
char *j = NULL; //(char *)malloc(100*sizeof(char));
int i,k; char n[100] = "hi";
//printf("%d",strlen(s));
for(i = 0;i<3;i++ )
{
j = strstr(s[i],str1);
if(j==0)
continue;
else
{
printf("j is %s",j);
printf("j is %s",j+10);
strcpy(j,str2);
printf("j is %s",j);
break;
}
}
printf("%s",s[1]);
return 0;