This commit is contained in:
Deinerovych 2024-10-16 22:42:58 +02:00
parent 3be4df45de
commit efefdd89e1

View File

@ -43,7 +43,7 @@ void push(float number) {
if (stack_top < STACK_SIZE - 1) { if (stack_top < STACK_SIZE - 1) {
stack[++stack_top] = number; stack[++stack_top] = number;
} else { } else {
printf("Error: stack overflow\n"); printf("stack overflow\n");
exit(0); exit(0);
} }
} }
@ -52,7 +52,7 @@ float pop() {
if (stack_top >= 0) { if (stack_top >= 0) {
return stack[stack_top--]; return stack[stack_top--];
} else { } else {
printf("Error: stack is empty\n"); printf("stack is empty\n");
exit(0); exit(0);
} }
} }
@ -95,7 +95,12 @@ int main() {
push(result); push(result);
print_stack(); print_stack();
} }
else {
printf("bad input\n");
return 0;
} }
}
printf("no input\n"); printf("no input\n");
return 0; return 0;