This commit is contained in:
Oleksandr Vyshniakov 2025-10-12 20:40:20 +02:00
parent de6f6c6ad0
commit 603a764d2d
2 changed files with 16 additions and 19 deletions

Binary file not shown.

View File

@ -1,34 +1,31 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#define STACK_SIZE 10
struct stack {
float values[STACK_SIZE];
struct stack{
float *values;
int size;
int capacity;
};
void push_stack(struct stack* stack, float value) {
if (stack->size >= STACK_SIZE) {
printf("Error!\n");
struct stack* create_stack (int capacity) {
struct stack* s = malloc (sizeof(struct stack));
if (s==NULL) {
printf("Error!");
exit(1);
}
stack->values[stack->size] = value;
stack->size++;
s->values = malloc(capacity * sizeof(float));
if (s->values==NULL) {
printf("Error!");
free(s);
exit(1);
}
s->size = 0;
s->capacity = capacity;
return s;
}
float pop_stack(struct stack* stack) {
}
int count_stack(struct stack* stuck) {
}
int main() {
return 0;
}