How can I find a word in a char array and censor it with wildcard (*) characters?
I've tried to find the first occurrence of the word, but failed. I've tried this and it didn't work either. I'm a newbie and I've been trying this for 5 hours.
int main()  
{
    int w,q;
    char l,m;
    char *arr, *swear;
    int i,a,t,k,z;
    printf("Enter a word which is not allowed.");
    scanf("%s", swear);
    printf("Now enter a word.");
    scanf("%s", arr);
    for(a=0; swear[a]!='\0'; ++a); //finding length of swear
    for(t=0;arr[t]!='\0';t++);    // finding length of arr
    for(i=0,k=0;k<t & i<t;i++,k++)
    {
        arr[i]=l;
        swear[k]=m;
        if(strstr(swear,arr))
            arr[i]='*';
        else
            break;
    }
    for(z=0;z<t;z++)
    {
        printf("%c",arr[z]);
    }
    return(0);
}
 
     
    