*
This commit is contained in:
@@ -3,15 +3,18 @@
|
||||
#include <assert.h>
|
||||
|
||||
struct stack_t {
|
||||
/*
|
||||
votre implantation
|
||||
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,11 +25,22 @@ 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->
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user