From 1dcb4845fdb668b8a74a207c82606907a1c93d30 Mon Sep 17 00:00:00 2001 From: Alina Konoval Date: Mon, 20 Oct 2025 21:24:57 +0200 Subject: [PATCH] 4 --- a1/program.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/a1/program.c b/a1/program.c index 33c6d5e..dafdfb5 100644 --- a/a1/program.c +++ b/a1/program.c @@ -38,7 +38,7 @@ int main(void) { if (fgets(code, sizeof(code), stdin) == NULL) return 0; - // Odstránenie znaku nového riadku, ak existuje + code[strcspn(code, "\n")] = '\0'; printf("Read: %s\n", code); @@ -51,12 +51,12 @@ int main(void) { stack[++top] = c; } else if (is_close(c)) { if (top < 0) { - printf("Unexpected closing bracket %c in %d\n", c, i); + printf("Unexpected closing bracket %c in %d\n ", c, i); return 0; } char last = stack[top--]; if (match(last) != c) - (void)(printf("Crossed bracket %c in %d, expected %c\n", c, i , match(last)), exit(0)); + (void)(printf("Crossed bracket %c in %d, expected %c\n ", c, i , match(last)), exit(0)); } }