This can't be answered in detail without knowing the
struct tnode
and the
talloc()
function.
Some suspicious instructions:
if(p==NULL){
p=talloc();
p->np=p->word;
*(p->np)=strdup(w);
p->count=1;
p->left=p->right=NULL;
}
else if((cond=strncmp(w,*(p->np),3))==0){
(p->np)++;
*(p->np)=strdup(w);
p->count++;
}
for(int i=0;(p->word[i])!="";i++)
printf("%4d %s\n",p->count,p->word[i]);