This commit is contained in:
Alina Konoval 2025-10-20 21:21:49 +02:00
parent 44ede0bb04
commit f20b798616

View File

@ -38,7 +38,7 @@ int main(void) {
if (fgets(code, sizeof(code), stdin) == NULL) if (fgets(code, sizeof(code), stdin) == NULL)
return 0; return 0;
// Odstránenie znaku nového riadku, ak existuje
code[strcspn(code, "\n")] = '\0'; code[strcspn(code, "\n")] = '\0';
printf("Read: %s\n", code); printf("Read: %s\n", code);
@ -60,9 +60,12 @@ int main(void) {
} }
} }
(top >= 0) (top >= 0)
? printf("Missing closing brackets: ", stack[top], (int)strlen(code)) ? (printf("Missing closing brackets: "),
: printf("All brackets OK\n"); ({ for (int i = top; i >= 0; i--) printf("%c", match(stack[i])); }),
printf("\n"))
: printf("All brackets OK\n");
return 0; return 0;
} }