It seems to be working but I need to ckeck again

This commit is contained in:
Meyer Simon
2025-05-03 19:29:38 -04:00
parent 468e3f67f7
commit 18b5daea0e
6 changed files with 181 additions and 27 deletions

View File

@ -58,7 +58,16 @@ int S_Size(Stack *s){
return s->size;
}
void S_Merge(Stack *s1, Stack *s2){
void S_Merge(Stack *list){
Stack* s1 = S_Pop(list);
Stack* s2 = S_Peek(list);
if(s1 == NULL){
return;
}
if(s2 == NULL){
S_Push(list, s1, 0);
return;
}
for (Instruction * i = S_Pop(s1); i; i = S_Pop(s1)){
S_Push(s2, i, 1);
}