Added popping logic, trying

This commit is contained in:
Anton Dolozin 2025-10-13 18:02:28 +02:00
parent 90fbfe67c3
commit 073cbbc45d

View File

@ -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;