This commit is contained in:
2023-10-12 16:07:28 +02:00
parent 458013fe74
commit 82cf22952d
6 changed files with 162 additions and 0 deletions

10
SCR3.1/TP6/stack/Makefile Normal file
View File

@@ -0,0 +1,10 @@
stack.o : stack.c
gcc -c stack.c
main.o : main.c stack.h
gcc -c main.c
main : main.o stack.o
gcc -o main main.o stack.o
all : main

21
SCR3.1/TP6/stack/main.c Normal file
View File

@@ -0,0 +1,21 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "stack.h"
int main(int argc, char *argv[])
{
int val;
stack_t * s=stack_create(20);
for(int i=0;i<20; i++)
stack_push(s,i);
for(int i=0;i<20; i++)
stack_pop(s,&val);
return 0;
}

32
SCR3.1/TP6/stack/stack.c Normal file
View File

@@ -0,0 +1,32 @@
#include "stack.h"
#include <stdlib.h>
#include <assert.h>
struct stack_t {
/*
votre implantation
*/
};
stack_t * stack_create( int max_size)
{
}
int stack_destroy(stack_t * s)
{
}
int stack_push(stack_t *s,int val)
{
}
int stack_pop(stack_t *s,int * val)
{
}

12
SCR3.1/TP6/stack/stack.h Normal file
View File

@@ -0,0 +1,12 @@
#ifndef _STACK_INT_H
#define _STACK_INT_H
typedef struct stack_t stack_t;
stack_t * stack_create(int max_size);
int stack_destroy(stack_t *s);
int stack_push(stack_t *s, int val);
int stack_pop(stack_t *s,int *val);
#endif