From 206c26a2cfe6cdd4cac3f6bd8d7e3c07e00da2ad Mon Sep 17 00:00:00 2001 From: Ivan Leichenko Date: Thu, 31 Oct 2024 18:46:56 +0100 Subject: [PATCH] invert output order a1 --- a1/program.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/a1/program.c b/a1/program.c index 5de21f8..7c978ae 100644 --- a/a1/program.c +++ b/a1/program.c @@ -54,7 +54,7 @@ int main() memset(input, 0, len); sprintf(input,"Missing closing brackets: "); len = strlen(input); - for (int i = 0; i <= top; i++) + for (int i = top; i >= 0; i--) { input[len++] = (stack[i] == '(' ? ')' : stack[i] == '{' ? '}' : stack[i] == '[' ? ']' : '>'); }