编辑代码

#include <stdio.h>
#include <string.h>
void FindLong(char str[],char word[])
{
    int i=0,j=0,len=0;
    while(str[i]!='\0')
    {
        while(str[j]!=' '&&str[j]!='\0')
        {
            j++;
        }
        len=j-i;
        if(len>strlen(word))
        {
            strncpy(word,str+i,len);
        }
        j++;
        i=j;
    }
}
int main () {
    char line[1000],word[50];
    gets(line);
    FindLong(line,word);
    printf("这段英文中最长的单词是:%s",word);
    return 0;
}