diff --git a/hangman.c b/hangman.c index eabfc95..6863801 100644 --- a/hangman.c +++ b/hangman.c @@ -176,7 +176,7 @@ void initAlphabet(game_state *gs) { break; } } - gs->alphabet = malloc(sizeof(char) * hasNumber ? ALPHABET : ALPHABET_NUM); + gs->alphabet = malloc(sizeof(char) * ((hasNumber ? ALPHABET : ALPHABET_NUM) + 1)); strcpy(gs->alphabet, "abcdefghijklmnopqrstuvwxyz"); if (hasNumber) { @@ -226,7 +226,7 @@ void drawGuessWord(game_state *gs) { } rows++; } - gs->wordRows = rows; //set the number of rows for clearing the screen later + gs->wordRows = rows; //set the number of rows for clearing the screen later tempstartpos = xcounter = gs->centerx - (gs->wordLength / rows); } for (i = startpos; i < startpos + (gs->wordLength * 2); i++) {