#include #include #define MAX_WORD_SIZE 100 #define MAX_NUM_WORDS 10000 typedef struct _wordRec { chat word[MAX_WORD_SIZE]; int count; } WordRec; static WordRec wordTable[MAX_NUM_WORDS]; int wordCount = 0; void addWord(char *word){ int i; for (i = 0; i < wordCount; i++){ if (strcmp(wordTable[i].word, word) == 0){ wordTable[i].count++ return; } } strcpy(wordTable[wordCount].word, word); wordTable[wordCount].count = 1; wordCount++; } void printWords() { int i; for (i=0; i < wordCount; i++) printf("%s %d\n", wordTable[i].word, wordTable[i].count); }