This commit is contained in:
Oleksandr Vyshniakov 2025-10-12 21:27:36 +02:00
parent b13a37108f
commit 780529c399

View File

@ -26,7 +26,7 @@ struct stack* create_stack (int capacity) {
return s; return s;
} }
void push_stack (struct stack* s, float value) { void push_stack(struct stack* s, float value) {
if (s->size >= s->capacity) { if (s->size >= s->capacity) {
printf("Stack perepolnen!\n"); printf("Stack perepolnen!\n");
exit(1); exit(1);
@ -58,7 +58,7 @@ void destroy_stack (struct stack* s) {
int main() { int main() {
struct stack* novystack = create_stack(STACK_SIZE); struct stack* novystack = create_stack(STACK_SIZE);
push_stack(novystack, 3,14); push_stack(novystack, 3.14);
push_stack(novystack, 2.71); push_stack(novystack, 2.71);
float x = pop_stack(novystack); float x = pop_stack(novystack);
printf("Popped: %2.f\n", x); printf("Popped: %2.f\n", x);