int fun( char *s)
{ //for循环遍历数组或者是while循环通过指针来遍历数组。
int i; //与取每一个的最后一个字母类似
int cnt=0; //注意for循环遍历的循环条件
for(i=0;s[i]!='\0';i++)
{
if(s[i]!=' '&&(s[i+1]==' '||s[i+1]=='\0'))
{
cnt++;
}
}
return cnt;
}
int fun( char *s)
{ //for循环遍历数组或者是while循环通过指针来遍历数组。
int i; //与取每一个的最后一个字母类似
int cnt=0; //注意for循环遍历的循环条件
for(i=0;s[i]!='\0';i++)
{
if(s[i]!=' '&&(s[i+1]==' '||s[i+1]=='\0'))
{
cnt++;
}
}
return cnt;
}