missing all brackets a1
This commit is contained in:
parent
4dea0649d6
commit
d7ee1284a2
10
a1/program.c
10
a1/program.c
@ -51,7 +51,15 @@ int main()
|
|||||||
|
|
||||||
if (top != -1)
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user