la mise en œuvre de strstr() la fonction

Le code dit à de nombreux endroits non valide "indirection".S'il vous plaît aider.

   int main()
    {

        char *s1,*s2,*position;
        printf("Enter string:\n");
        gets(s1);
        printf("Enter word to find:\n");
        gets(s2);
        *position=ststr(*s1,*s1);
        if(*position)
        printf("word is found at %c loc\n",*position);
        else
        printf("word not found");
        getch();
        return 0;

    }

char *strstr(char *s1,char *s2)
{
    int flag=1;
    char i,j;
    for(i=0; ;i++)
    {
        if(*s1[i]==*s2[0])
        for(j=i;*s2;j++)
        {
            if(*s1[j]!=*s2[j])
            flag=0;
        }

    }
    if(flag)
    return i;
    else
    return 0;
}
  • oh mon dieu, c'est plein d'étoiles!
  • Vous avez une autre façon que 😛 ?
InformationsquelleAutor Fahad Uddin | 2010-08-24