diff --git a/src/main/c/Hangman/playHangman.c b/src/main/c/Hangman/playHangman.c index 6930fdd..78298f9 100644 --- a/src/main/c/Hangman/playHangman.c +++ b/src/main/c/Hangman/playHangman.c @@ -24,6 +24,12 @@ void playHangman(char *wordToGuess) { continue; } + // Check if the guess is a single letter + if (strlen(&guess) != 1) { + printf("Please enter only one letter.\n"); + continue; + } + // Check if the letter has already been guessed by the player if (strchr(guessedLetters, guess) != NULL) { printf("You already guessed that letter. Try another letter.\n");