R&K 《the c programming》中的一个程序,该怎么解决

R&K 《the c programming》中的一个程序
======================================code==========================================
//头文件
#include<stdio.h>
#include<ctype.h>
#include<string.h>
#include<stdlib.h>
#include<conio.h>
#define MAXWORD 100
//二叉树node节点描述
struct tnode
{
char *word;/*指向单词的指针*/
int count;/*单词出现的次数*/
struct tnode *left;/*左子节点*/
struct tnode *right;/*右子节点*/
};
/*函数说明*/
/*一个树的创建*/
struct tnode * addtree(struct tnode*,char *);
/*打印树*/
void treeprint(struct tnode *);
/*单词*/
int getword(char *,int);
/*节点空间分配函数*/
struct tnode *talloc(void);
char *strdup(char *);
//int comment(void);
//int getch( void );
//主函数
main()
{
struct tnode * root;
char word[MAXWORD];
root=NULL;
while(getword(word,MAXWORD)!=EOF)
if(isalpha(word[0]))
root=addtree(root,word);
treeprint(root);
return 0;
}
int comment(void)
{
int c;
while((c=getch())!=EOF)
if(c=='*')
if((c=getch())=='/')
break;
else
ungetch(c);
return c;
}
int getword(char* word,int lim)
{
int c,d;
char *w=word;

while(isspace(c=getch()));
if(c!=EOF)
*w++=c;

if(isalpha(c)||c=='-'||c=='#')

{
for(;--lim>0;w++)
if(*w=getch()=='\\')
*++w=getch();
else if(c==*w)
{
w++;
break;}
else if(*w==EOF)
break;
else if(c=='/')
if((d=getch())=='*')
c=comment();
else
ungetch(d);
*w='\0';

}
return c;
}
struct tnode* talloc(void)
{
return (struct tnode*)malloc(sizeof tnode);
}
struct tnode* addtree(struct tnode* p,char* w)
{
int cond;
if(p==NULL) /*该单词是一个新单词*/
{
p=talloc(); /*创建一个新节点*/
p->word=strdup(w);
p->count=1;
p->left=p->right=NULL;
}
else if((cond=strcmp(w,p->word))==0)
p->count++;/*匹配加1*/
else if(cond<0)
p->left=addtree(p->left,w);
else 
p->right=addtree(p->right,w);
return p;
}
void treeprint(struct tnode* p)
{
if(p!=NULL)
{
treeprint(p->left);
printf("%4d %s\n",p->count,p->word);
treeprint(p->right);
}
}
char * strdup(char* s)
{
char* p;
p=(char *)malloc(strlen(s)+1);
if(p!=NULL)
strcpy(p,s);
return p;
}
=================================code end==========================================
当重键盘输入字符时,为什么没有出现结果,我初步想是getword这个函数有问题,但不知道错在那
谁能帮我看我一下?

------解决方案--------------------
我刚把那个程序又看了一遍,也自己实现了一遍,没问题。