Added popping logic, trying
This commit is contained in:
parent
90fbfe67c3
commit
073cbbc45d
10
a1/program.c
10
a1/program.c
@ -196,22 +196,22 @@ if(*head != NULL){
|
|||||||
printf("Read: %sMissing closing brackets: ", buff);
|
printf("Read: %sMissing closing brackets: ", buff);
|
||||||
LinkedNode* ptr = *head;
|
LinkedNode* ptr = *head;
|
||||||
while(ptr){
|
while(ptr){
|
||||||
if(ptr->data == '['){
|
char popped = pop(&ptr);
|
||||||
|
if(popped == '['){
|
||||||
putchar(']');
|
putchar(']');
|
||||||
|
|
||||||
}
|
}
|
||||||
if(ptr->data == '('){
|
if(popped== '('){
|
||||||
putchar(')');
|
putchar(')');
|
||||||
|
|
||||||
}
|
}
|
||||||
if(ptr->data == '{'){
|
if(popped == '{'){
|
||||||
putchar('}');
|
putchar('}');
|
||||||
|
|
||||||
}
|
}
|
||||||
if(ptr->data == '<'){
|
if(popped == '<'){
|
||||||
putchar('>');
|
putchar('>');
|
||||||
}
|
}
|
||||||
ptr = ptr->next;
|
|
||||||
}
|
}
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
return;
|
return;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user