aboutsummaryrefslogblamecommitdiff
path: root/6.4/main.c
blob: c5a225569880e99c58f8f4dc076e84c4d054de0a (plain) (tree)



























                                                   
#include <stdio.h>
#include <ctype.h>
#include "word.h"
#include "tree.h"

#define MAXWORD		100
#define NDISTINCTTREE	1000

struct tnode *tlist[NDISTINCTTREE];

int main(void)
{
	char word[MAXWORD];
	struct tnode *root;
	int nt;
	
	root = NULL;
	while (getword(word, MAXWORD) != EOF)
		if (isalpha(word[0]))
			root = addtree(root, word);

	nt = tlstore(root, tlist, NDISTINCTTREE);
	tlsort(tlist, nt);
	printtl(tlist, nt);
	tfree(root);

	return 0;
}