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; }