Update 'a2/program.c'
This commit is contained in:
parent
9078d3a3c1
commit
69f2c49596
@ -86,7 +86,7 @@ int main(){
|
|||||||
|
|
||||||
}
|
}
|
||||||
else if(!find_pair(gettop(), line[i])){
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
@ -100,7 +100,6 @@ int main(){
|
|||||||
int begin = 0;
|
int begin = 0;
|
||||||
int end = strlen(r_bracket);
|
int end = strlen(r_bracket);
|
||||||
int temp;
|
int temp;
|
||||||
//printf("%s", b);
|
|
||||||
while(begin < end){
|
while(begin < end){
|
||||||
temp = r_bracket[begin];
|
temp = r_bracket[begin];
|
||||||
r_bracket[begin++] = r_bracket[--end];
|
r_bracket[begin++] = r_bracket[--end];
|
||||||
@ -113,7 +112,9 @@ int main(){
|
|||||||
else {
|
else {
|
||||||
printf("Missing closing brackets: %s\n", r_bracket);
|
printf("Missing closing brackets: %s\n", r_bracket);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(l_bracket);
|
free(l_bracket);
|
||||||
free(r_bracket);
|
free(r_bracket);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user