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] == '[' ? ']' : '>'); }