diff --git a/src/main/c/Tim/hangman.c b/src/main/c/Tim/hangman.c index df569e2..0e63451 100644 --- a/src/main/c/Tim/hangman.c +++ b/src/main/c/Tim/hangman.c @@ -4,7 +4,10 @@ #include #include -char wordlist[10][30] = { +#define LISTSIZE 10 +#define MAX_WORD_LENGTH 30 + +char wordlist[LISTSIZE][MAX_WORD_LENGTH] = { "Kartoffel", "Zigarette", "Haus", "Fenster", "Kartenleseettiketiergeraet", "Kleiderschrank", "Schnee","Wasserhahn", "Fernbedienung", "Computertastatur" @@ -22,10 +25,10 @@ void hangman() do { - char guessWord[30]; - char displayWord[30]; + char guessWord[MAX_WORD_LENGTH]; + char displayWord[MAX_WORD_LENGTH]; int length; - strcpy(guessWord,wordlist[rand() % 10]); + strcpy(guessWord,wordlist[rand() % LISTSIZE]); length = strlen(guessWord); printf("%s %d\n",guessWord, length); for (int i = 0; i <= length; i++)