Deklarierung der Fehlerhaften funktion aus der deklaration einer anderen funkton gezogen
This commit is contained in:
parent
078e326e4d
commit
fe1cb95cc0
@ -6,6 +6,17 @@
|
|||||||
// eine Funktion implementieren, die ein einzelnes Wort aus einer Textdatei (words.txt) einliest und als C-String zurückgibt.
|
// eine Funktion implementieren, die ein einzelnes Wort aus einer Textdatei (words.txt) einliest und als C-String zurückgibt.
|
||||||
|
|
||||||
// Read words from file and store in 'words' array
|
// Read words from file and store in 'words' array
|
||||||
|
int isValidWord(const char *word)
|
||||||
|
{
|
||||||
|
for (int i = 0;word[i]; i++)
|
||||||
|
{
|
||||||
|
if (!('A' <= word[i] && word[i] <= 'Z'))
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
|
int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
|
||||||
{
|
{
|
||||||
char line[1024]; // Puffer für eine Zeile
|
char line[1024]; // Puffer für eine Zeile
|
||||||
@ -28,17 +39,7 @@ int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
|
|||||||
|
|
||||||
// Prüfen, ob das Wort nur A-Z enthält
|
// Prüfen, ob das Wort nur A-Z enthält
|
||||||
|
|
||||||
int isValidWord(const char *word)
|
|
||||||
{
|
|
||||||
for (int i = 0;word[i]; i++)
|
|
||||||
{
|
|
||||||
if (!('A' <= word[i] && word[i] <= 'Z'))
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isValidWord(token))
|
if (!isValidWord(token))
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user