All pastes #481839 Raw Edit

Mine

public c v1 · immutable
·published 2007-05-11 00:37 UTC
rendered paste body
#include <stdio.h>#include <strings.h>#define MAX_WORD_SIZE 100#define MAX_NUM_WORDS 10000typedef 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);}