diff --git a/du3/output/program.exe b/du3/output/program.exe index 7099261..cead150 100644 Binary files a/du3/output/program.exe and b/du3/output/program.exe differ diff --git a/du3/program.c b/du3/program.c index dee0e9f..5fba259 100644 --- a/du3/program.c +++ b/du3/program.c @@ -1,34 +1,31 @@ #include #include #include -#include #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; } \ No newline at end of file