From e2ae3d27736bc671100914f523e9f85dceeb6138 Mon Sep 17 00:00:00 2001 From: VIliam Date: Thu, 31 Oct 2024 23:42:43 +0100 Subject: [PATCH] s --- a1/program.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/a1/program.c b/a1/program.c index 08b1408..6aac6d0 100644 --- a/a1/program.c +++ b/a1/program.c @@ -10,7 +10,7 @@ void check_brackets(const char *code) { char stack[100]; int top = -1; - printf("Read: %s", code); + printf("Read: %s", code); // Výstup pre načítanie vstupu for (int i = 0; code[i] != '\0'; i++) { char c = code[i]; @@ -37,7 +37,8 @@ void check_brackets(const char *code) { int main() { char code[100]; - fgets(code, 100, stdin); - check_brackets(code); + if (fgets(code, sizeof(code), stdin) != NULL) { + check_brackets(code); + } return 0; }