TP6
This commit is contained in:
10
SCR3.1/TP6/stack/Makefile
Normal file
10
SCR3.1/TP6/stack/Makefile
Normal 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
21
SCR3.1/TP6/stack/main.c
Normal 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
32
SCR3.1/TP6/stack/stack.c
Normal 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
12
SCR3.1/TP6/stack/stack.h
Normal 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
|
||||
Reference in New Issue
Block a user