完颜萍和完颜洪烈:请教一道三级题 单词倒排 调用函数没读懂 请帮个忙

来源:百度文库 编辑:中科新闻网 时间:2024/05/10 11:52:07
void strol(void)
{ int i,j;
char word[21],yy[80],zz[80],*p ;
for(i=0;i<maxline;i++)
{
p=xx[i];
j=0;
memset(word,0,21) ;
memset(yy,0,80) ;
while(*p)
{
if(isalpha(*p))
{
word[j++]=*p++ ;
if(*p) continue ;
}
strcpy(zz,yy) ;
sprintf(yy,"%s %s",word,zz);
j=0;
memset(word,0,21) ;
while(*p&&(!isalpha(*p))) p++;
}
strcpy(xx[i],yy) ;
}
}
请详细解说一下

metset(word,0,21)是将 word数组中的所有字符(这里是21)置为0(即'\0')
isalpha(*p) *p为单词则返回非0,否则返回0。
其他应该能看懂吧,呵呵。