From 69f2c4959674dc6f9142ecda33f441046aaaea4c Mon Sep 17 00:00:00 2001 From: Maryna Kravtsova Date: Wed, 21 Oct 2020 14:18:07 +0000 Subject: [PATCH] Update 'a2/program.c' --- a2/program.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/a2/program.c b/a2/program.c index a02d772..a7e2c41 100644 --- a/a2/program.c +++ b/a2/program.c @@ -86,7 +86,7 @@ int main(){ } else if(!find_pair(gettop(), line[i])){ - printf("Crossed bracket %c in %d, expected %c \n", line[i], i, r_bracket[j]); + printf("Crossed bracket %c in %d, expected %c \n", line[i], i, r_bracket[f]); return 0; } else{ @@ -100,7 +100,6 @@ int main(){ int begin = 0; int end = strlen(r_bracket); int temp; - //printf("%s", b); while(begin < end){ temp = r_bracket[begin]; r_bracket[begin++] = r_bracket[--end]; @@ -113,7 +112,9 @@ int main(){ else { printf("Missing closing brackets: %s\n", r_bracket); } + free(l_bracket); free(r_bracket); + return 0; }