SCR/SCR3.1/TP6/stack/stack.c
2023-12-10 15:48:26 +01:00

47 lines
582 B
C

#include "stack.h"
#include <stdlib.h>
#include <assert.h>
struct stack_t {
int size;
int * tableau;
int index;
};
stack_t * stack_create( int max_size)
{
stack_t new;
new.size = max_size;
new.index = index;
return *new;
}
int stack_destroy(stack_t * s)
{
}
int stack_push(stack_t *s,int val)
{
if (s->index == 0){
s->tableau = malloc(s->size * sizeof(int);
}
if (s->index == s->size - 1){
return -1
}
s->tableau[value]=val;
s->value = s->value + 1;
return EXIT_SUCCESS;
}
int stack_pop(stack_t *s,int * val)
{
if (s->index == 0){
return -1;
}
s->
}