This commit is contained in:
Oleksandr Vyshniakov 2025-10-12 21:18:38 +02:00
parent d08b36f4b8
commit e1bbef4fbe

View File

@ -37,19 +37,23 @@ void push_stack (struct stack* s, float value) {
float pop_stack(struct stack* s) { float pop_stack(struct stack* s) {
if (s->size <= 0) { if (s->size <= 0) {
prinf("Erroe!\n"); printf("Erroe!\n");
exit(1); exit(1);
} }
s->size--; s->size--;
return return s->values[s->size];
} }
void print_stack(struct stack* s) { void print_stack(struct stack* stack) {
for (int i = 0; i<stack->size; i++) {
printf("%.2f", stack->values[i]);
}
printf("\n");
} }
void destroy_stack (struct stack* s) { void destroy_stack (struct stack* s) {
free(s->values);
free(s);
} }
int main() { int main() {