diff --git a/a1/program.c b/a1/program.c index ea85b80..726173c 100644 --- a/a1/program.c +++ b/a1/program.c @@ -51,7 +51,15 @@ int main() if (top != -1) { - printf("Missing closing brackets: %c\n", (stack[top] == '(' ? ')' : stack[top] == '{' ? '}' : stack[top] == '[' ? ']' : '>')); + memset(input, 0, len); + sprintf(input,"Missing closing brackets: "); + len = strlen(input); + for (int i = 0; i <= top; i++) + { + input[len++] = (stack[i] == '(' ? ')' : stack[i] == '{' ? '}' : stack[i] == '[' ? ']' : '>'); + } + input[len] = 0; + printf("%s", input); return 0; }