// file hangman.h - wdg 2009 #include #include // for strlen function #include // for rand and srand functions #include // for time function char * getRandomSecret(); char getGuess(char secret[], int found[]); int isInGuess(char try, char secret[], int found[]); void updateProgress(char try, char secret[], int found[]); int haveAllLetters(int found[], int length); void play(char secret[]); void loadDictionary(); // supplied below void freeDictionary(); // supplied below const int MAX_WORD_LENGTH = 20; const int MAX_WORDS = 1000; const int MAX_MISSES = 8; const char BLANK = '_'; const char DICTIONARY[] = "list.txt"; // filename of list of words char **dictionary = 0; // an array of strings int numberOfWords; // this loads words from file into array dictionary // it should be called at the start of the main function if user needs it void loadDictionary( ) { FILE *infile; infile = fopen( DICTIONARY, "r"); if( !infile ) { printf("Unable to open file\n"); return; } fscanf( infile, "%d", &numberOfWords); dictionary = (char **) malloc( numberOfWords * sizeof(char*)); if( dictionary == NULL) { printf("Out of memory"); return; } int count=0; while( count