Entfernen von doppelter else func

This commit is contained in:
hruschkajo103995 committed 2026-10-28 22:20:01 +01:00
1 parent 6340b63273
commit c2d35dfe89
2 files changed
+9 -19

No files matched your search

+6 -17
View File
@@ -9,8 +9,7 @@
#define MAX_NUMBER_OF_WORDS 100
#define SALAD_SIZE 20
int main(int argc, char *argv[])
{
int main(int argc, char *argv[]) {
int exitCode = EXIT_SUCCESS;
srand(time(NULL)); //Seed für Zufallszahlen
@@ -21,8 +20,7 @@ int main(int argc, char *argv[])
fprintf(stderr, "Usage: %s <path to file with search words>\n", argv[0]);
exitCode = EXIT_FAILURE;
}
else
{
else {
char words[MAX_NUMBER_OF_WORDS][MAX_WORD_LEN]; // Array to hold the words to be used in the game
unsigned int wordCount = 0;
@@ -47,21 +45,12 @@ int main(int argc, char *argv[])
}
else
{
// Fehler beim Erstellen des Wortsalats
fprintf(stderr,
"Fehler beim Erstellen des Wortsalats. Rueckgabewert: %d\n",
(int)placedWords);
// Print error message if file couldn't be opened
fprintf(stderr, "Could not open file %s for reading ...\n", argv[1]);
exitCode = EXIT_FAILURE;
}
}
}
else
{
// Print error message if file couldn't be opened
fprintf(stderr, "Could not open file %s for reading ...\n", argv[1]);
exitCode = EXIT_FAILURE;
}
return exitCode;
}
return exitCode;
}