--- /dev/null
+# Sample Makefile to build simple project.
+#
+# This Makefile expect all source files (.c) to be at the same level, in the
+# current working directory.
+#
+# It will automatically generate dependencies, compile all files, and produce a
+# binary using the provided name.
+#
+# Set BINARY_NAME to the name of the binary file to build.
+# Set BUILD_TYPE to either debug or release
+#
+# Automatic dependencies code from:
+# http://make.mad-scientist.net/papers/advanced-auto-dependency-generation/#tldr
+BINARY_NAME=pile_contigue
+BUILD_TYPE=debug
+
+# ====================================
+# DO NOT CHANGE STUFF BEYOND THIS LINE
+# ====================================
+
+all: $(BINARY_NAME)
+
+CC=gcc
+LD=gcc
+
+WARN_FLAGS = -Wall -Wextra
+STD_FLAG = -std=c99
+
+ifeq ($(BUILD_TYPE),debug)
+BUILDDIR := .build/debug
+DEBUG_FLAG = -g
+STRIP_FLAG =
+OPTI_FLAG = -O0
+else
+BUILDDIR := .build/release
+DEBUG_FLAG =
+STRIP_FLAG = -s
+OPTIFLAG = -O3
+endif
+
+CFLAGS := $(CFLAGS) $(WARN_FLAGS) $(STD_FLAG) $(OPTI_FLAG) $(DEBUG_FLAG)
+LDFLAGS := $(LDFLAGS) $(STRIP_FLAG)
+
+OBJDIR := $(BUILDDIR)/objs
+$(shell mkdir -p $(OBJDIR))
+
+SRCS=$(wildcard *.c)
+OBJS=$(patsubst %.c,$(OBJDIR)/%.o,$(SRCS))
+
+DEPDIR := $(BUILDDIR)/deps
+$(shell mkdir -p $(DEPDIR))
+DEPFLAGS = -MT $@ -MMD -MP -MF $(DEPDIR)/$*.Td
+POSTCOMPILE = mv -f $(DEPDIR)/$*.Td $(DEPDIR)/$*.d
+
+$(BINARY_NAME): $(OBJS)
+ @echo "[LD ] $@"
+ @$(LD) $(CFLAGS) $(LDFLAGS) $^ $(LDLIBS) -o $@
+
+$(OBJDIR)/%.o: %.c $(DEPDIR)/%.d
+ @echo "[C ] $*"
+ @$(CC) $(DEPFLAGS) $(CFLAGS) -c $< -o $@
+ @$(POSTCOMPILE)
+
+$(DEPDIR)/%.d: ;
+
+.PRECIOUS: $(DEPDIR)/%.d
+
+include $(wildcard $(patsubst %,$(DEPDIR)/%.d,$(basename $(SRCS))))
+
+clean:
+ @echo "[CLN]"
+ -@rm -r $(BUILDDIR)
+ -@rm $(BINARY_NAME)
+
+disassemble: $(BINARY_NAME)
+ objdump -d $< | less
+
+symbols: $(BINARY_NAME)
+ objdump -t $< | sort | less
--- /dev/null
+/*******************************************************************************
+ Implantation contiguë d'un type Pile d'entiers
+
+La pile est représentée par une structure:
+ un tableau représente les valeurs
+ un entier représente le nombre d'éléments de la pile
+*******************************************************************************/
+#include<stdio.h>
+#include<stdlib.h>
+
+#define LONG_PILE 25
+typedef int element;
+typedef struct { int nbre;
+ element tab[LONG_PILE];} Pile;
+
+Pile pile_vide(void)
+{ Pile p; p.nbre=0;
+ return p;
+}
+
+int est_vide(Pile p)
+{ return p.nbre==0; /* ou return !p.nbre; */
+}
+
+element sommet(Pile p)
+/* ATTENTION: consulter le sommet d'une pile vide n'a pas de sens */
+{ if (est_vide(p)) { printf("Erreur - pile vide\n"); exit(-1); }
+ return p.tab[p.nbre-1];
+}
+Pile empiler(element e,Pile p)
+{ if (p.nbre==LONG_PILE) { printf("Erreur - pile pleine\n"); exit(-1); }
+p.tab[p.nbre++]=e;
+ return p;
+}
+
+Pile depiler(Pile p)
+/* ATTENTION: supprimer le sommet d'une pile vide n'a pas de sens */
+{ if (est_vide(p)) { printf("Erreur - pile vide\n"); exit(-1); }
+p.nbre--;
+ return p;
+}
+
+element depiler2(Pile *p) /* ATTENTION: la pile est modifiée */
+/* ATTENTION: dépiler une pile vide n'a pas de sens */
+{ if (est_vide(*p)) { printf("Erreur - pile vide\n"); exit(-1); }
+return p->tab[p->nbre-- -1];
+}
+/******************************************************************************/
+
+
+int main()
+{Pile p;
+ int i;
+
+ p=pile_vide();
+
+ for (i=0; i<20; i++) p=empiler(i,p);
+
+ for (i=0; i<25; i++) printf("%d\n",depiler2(&p));
+}
+/********************************************************************/
+
--- /dev/null
+# Sample Makefile to build simple project.
+#
+# This Makefile expect all source files (.c) to be at the same level, in the
+# current working directory.
+#
+# It will automatically generate dependencies, compile all files, and produce a
+# binary using the provided name.
+#
+# Set BINARY_NAME to the name of the binary file to build.
+# Set BUILD_TYPE to either debug or release
+#
+# Automatic dependencies code from:
+# http://make.mad-scientist.net/papers/advanced-auto-dependency-generation/#tldr
+BINARY_NAME=pile_realloc
+BUILD_TYPE=debug
+
+# ====================================
+# DO NOT CHANGE STUFF BEYOND THIS LINE
+# ====================================
+
+all: $(BINARY_NAME)
+
+CC=gcc
+LD=gcc
+
+WARN_FLAGS = -Wall -Wextra
+STD_FLAG = -std=c99
+
+ifeq ($(BUILD_TYPE),debug)
+BUILDDIR := .build/debug
+DEBUG_FLAG = -g
+STRIP_FLAG =
+OPTI_FLAG = -O0
+else
+BUILDDIR := .build/release
+DEBUG_FLAG =
+STRIP_FLAG = -s
+OPTIFLAG = -O3
+endif
+
+CFLAGS := $(CFLAGS) $(WARN_FLAGS) $(STD_FLAG) $(OPTI_FLAG) $(DEBUG_FLAG)
+LDFLAGS := $(LDFLAGS) $(STRIP_FLAG)
+
+OBJDIR := $(BUILDDIR)/objs
+$(shell mkdir -p $(OBJDIR))
+
+SRCS=$(wildcard *.c)
+OBJS=$(patsubst %.c,$(OBJDIR)/%.o,$(SRCS))
+
+DEPDIR := $(BUILDDIR)/deps
+$(shell mkdir -p $(DEPDIR))
+DEPFLAGS = -MT $@ -MMD -MP -MF $(DEPDIR)/$*.Td
+POSTCOMPILE = mv -f $(DEPDIR)/$*.Td $(DEPDIR)/$*.d
+
+$(BINARY_NAME): $(OBJS)
+ @echo "[LD ] $@"
+ @$(LD) $(CFLAGS) $(LDFLAGS) $^ $(LDLIBS) -o $@
+
+$(OBJDIR)/%.o: %.c $(DEPDIR)/%.d
+ @echo "[C ] $*"
+ @$(CC) $(DEPFLAGS) $(CFLAGS) -c $< -o $@
+ @$(POSTCOMPILE)
+
+$(DEPDIR)/%.d: ;
+
+.PRECIOUS: $(DEPDIR)/%.d
+
+include $(wildcard $(patsubst %,$(DEPDIR)/%.d,$(basename $(SRCS))))
+
+clean:
+ @echo "[CLN]"
+ -@rm -r $(BUILDDIR)
+ -@rm $(BINARY_NAME)
+
+disassemble: $(BINARY_NAME)
+ objdump -d $< | less
+
+symbols: $(BINARY_NAME)
+ objdump -t $< | sort | less
--- /dev/null
+/********************************************************************/
+/* Implantation contiguë d'un type Pile d'entiers */
+/* On rallonge le tableau par realloc quand il est plein */
+/********************************************************************/
+#include <stdio.h>
+#include <stdlib.h>
+
+#define LONG_PILE 5
+typedef int element;
+typedef struct { int nbre;
+ int taille_tab;
+ element *tab; } Pile;
+
+Pile pile_vide(void)
+{Pile p; p.nbre=0; p.taille_tab=LONG_PILE;
+ p.tab=(element *)calloc(p.taille_tab, sizeof(element));
+ return p;
+}
+
+int est_vide(Pile p)
+{return p.nbre==0; /* ou return !p.nbre; */
+}
+
+element sommet(Pile p)
+/* ATTENTION: consulter le sommet d'une pile vide n'a pas de sens */
+{if (est_vide(p)) { printf("Erreur - pile vide\n"); exit(-1); }
+ return p.tab[p.nbre-1];
+}
+
+Pile empiler(element e,Pile p)
+{if (p.nbre==p.taille_tab)
+ {printf("pile pleine %d - on la rallonge!\n",p.taille_tab);
+ p.taille_tab *=2;
+ p.tab=realloc(p.tab, p.taille_tab*sizeof(element));
+ }
+ p.tab[p.nbre++]=e;
+ return p;
+}
+
+Pile depiler(Pile p)
+/* ATTENTION: supprimer le sommet d'une pile vide n'a pas de sens */
+{if (est_vide(p)) { printf("Erreur - pile vide\n"); exit(-1); }
+ p.nbre--;
+ return p;
+}
+
+element depiler2(Pile *p) /* ATTENTION: la pile est modifiée */
+/* ATTENTION: dépiler une pile vide n'a pas de sens */
+{if (est_vide(*p)) { printf("Erreur - pile vide\n"); exit(-1); }
+ return p->tab[p->nbre-- -1];
+}
+/********************************************************************/
+
+int main()
+{Pile p;
+ int i;
+
+ p=pile_vide();
+
+ for (i=0; i<20; i++) p=empiler(i,p);
+
+ for (i=0; i<25; i++) printf("%d\n",depiler2(&p));
+}
+/********************************************************************/
+
--- /dev/null
+# Sample Makefile to build simple project.
+#
+# This Makefile expect all source files (.c) to be at the same level, in the
+# current working directory.
+#
+# It will automatically generate dependencies, compile all files, and produce a
+# binary using the provided name.
+#
+# Set BINARY_NAME to the name of the binary file to build.
+# Set BUILD_TYPE to either debug or release
+#
+# Automatic dependencies code from:
+# http://make.mad-scientist.net/papers/advanced-auto-dependency-generation/#tldr
+BINARY_NAME=file_contigue
+BUILD_TYPE=debug
+
+# ====================================
+# DO NOT CHANGE STUFF BEYOND THIS LINE
+# ====================================
+
+all: $(BINARY_NAME)
+
+CC=gcc
+LD=gcc
+
+WARN_FLAGS = -Wall -Wextra
+STD_FLAG = -std=c99
+
+ifeq ($(BUILD_TYPE),debug)
+BUILDDIR := .build/debug
+DEBUG_FLAG = -g
+STRIP_FLAG =
+OPTI_FLAG = -O0
+else
+BUILDDIR := .build/release
+DEBUG_FLAG =
+STRIP_FLAG = -s
+OPTIFLAG = -O3
+endif
+
+CFLAGS := $(CFLAGS) $(WARN_FLAGS) $(STD_FLAG) $(OPTI_FLAG) $(DEBUG_FLAG)
+LDFLAGS := $(LDFLAGS) $(STRIP_FLAG)
+
+OBJDIR := $(BUILDDIR)/objs
+$(shell mkdir -p $(OBJDIR))
+
+SRCS=$(wildcard *.c)
+OBJS=$(patsubst %.c,$(OBJDIR)/%.o,$(SRCS))
+
+DEPDIR := $(BUILDDIR)/deps
+$(shell mkdir -p $(DEPDIR))
+DEPFLAGS = -MT $@ -MMD -MP -MF $(DEPDIR)/$*.Td
+POSTCOMPILE = mv -f $(DEPDIR)/$*.Td $(DEPDIR)/$*.d
+
+$(BINARY_NAME): $(OBJS)
+ @echo "[LD ] $@"
+ @$(LD) $(CFLAGS) $(LDFLAGS) $^ $(LDLIBS) -o $@
+
+$(OBJDIR)/%.o: %.c $(DEPDIR)/%.d
+ @echo "[C ] $*"
+ @$(CC) $(DEPFLAGS) $(CFLAGS) -c $< -o $@
+ @$(POSTCOMPILE)
+
+$(DEPDIR)/%.d: ;
+
+.PRECIOUS: $(DEPDIR)/%.d
+
+include $(wildcard $(patsubst %,$(DEPDIR)/%.d,$(basename $(SRCS))))
+
+clean:
+ @echo "[CLN]"
+ -@rm -r $(BUILDDIR)
+ -@rm $(BINARY_NAME)
+
+disassemble: $(BINARY_NAME)
+ objdump -d $< | less
+
+symbols: $(BINARY_NAME)
+ objdump -t $< | sort | less
--- /dev/null
+/**************************************************************************
+ Implantation contiguë d'un type File d'entiers
+
+ La File est représentée par une structure:
+ un tableau représente les valeurs
+ un entier représente la position de la tête de la File
+ un entier représente la position de la queue de la File
+
+ le tableau est exploité de façon circulaire.
+**************************************************************************/
+#include <stdio.h>
+#include <stdlib.h>
+
+#define LONG_FILE 25
+
+typedef int element;
+typedef struct { int tete;
+ int queue;
+ element tab[LONG_FILE]; } File;
+
+File file_vide(void)
+{ File f={0,0}; /* f.tete=f.queue=0 */
+ return f;
+}
+
+int est_vide(File f) { return f.tete==f.queue; }
+
+int est_pleine(File f) { return (f.queue+1)%LONG_FILE==f.tete; }
+
+element tete(File f)
+/* ATTENTION: consulter la tête d'une File vide n'a pas de sens */
+{ if (est_vide(f)) { printf("Erreur - file vide\n"); exit(-1); }
+return f.tab[f.tete];
+}
+File enfiler(element e,File f)
+{ if (est_pleine(f)) { printf("Erreur - file pleine\n"); exit(-1); }
+ f.tab[f.queue]=e; f.queue=(f.queue+1)%LONG_FILE;
+ return f;
+}
+
+File defiler(File f)
+/* ATTENTION: supprimer la tête d'une File vide n'a pas de sens */
+{ if (est_vide(f)) { printf("Erreur - file vide\n"); exit(-1); }
+ f.tete=(f.tete+1)%LONG_FILE;
+ return f;
+}
+
+element defiler2(File * f) /*ATTENTION: la File est modifiée */
+/* ATTENTION: défiler une File vide n'a pas de sens */
+{ element e;
+ if (est_vide(*f)) { printf("Erreur - file vide\n"); exit(-1); }
+e=f->tab[f->tete];
+ f->tete=(f->tete+1)%LONG_FILE;
+ return e;
+}
+/*************************************************************************/
+
+
+int main()
+{File p;
+ int i;
+
+ p=file_vide();
+
+ for (i=0; i<20; i++) p=enfiler(i,p);
+
+ for (i=0; i<25; i++) printf("%d\n",defiler2(&p));
+}
+/********************************************************************/
+
--- /dev/null
+# Sample Makefile to build simple project.
+#
+# This Makefile expect all source files (.c) to be at the same level, in the
+# current working directory.
+#
+# It will automatically generate dependencies, compile all files, and produce a
+# binary using the provided name.
+#
+# Set BINARY_NAME to the name of the binary file to build.
+# Set BUILD_TYPE to either debug or release
+#
+# Automatic dependencies code from:
+# http://make.mad-scientist.net/papers/advanced-auto-dependency-generation/#tldr
+BINARY_NAME=list_chainee
+BUILD_TYPE=debug
+
+# ====================================
+# DO NOT CHANGE STUFF BEYOND THIS LINE
+# ====================================
+
+all: $(BINARY_NAME)
+
+CC=gcc
+LD=gcc
+
+WARN_FLAGS = -Wall -Wextra
+STD_FLAG = -std=c99
+
+ifeq ($(BUILD_TYPE),debug)
+BUILDDIR := .build/debug
+DEBUG_FLAG = -g
+STRIP_FLAG =
+OPTI_FLAG = -O0
+else
+BUILDDIR := .build/release
+DEBUG_FLAG =
+STRIP_FLAG = -s
+OPTIFLAG = -O3
+endif
+
+CFLAGS := $(CFLAGS) $(WARN_FLAGS) $(STD_FLAG) $(OPTI_FLAG) $(DEBUG_FLAG)
+LDFLAGS := $(LDFLAGS) $(STRIP_FLAG)
+
+OBJDIR := $(BUILDDIR)/objs
+$(shell mkdir -p $(OBJDIR))
+
+SRCS=$(wildcard *.c)
+OBJS=$(patsubst %.c,$(OBJDIR)/%.o,$(SRCS))
+
+DEPDIR := $(BUILDDIR)/deps
+$(shell mkdir -p $(DEPDIR))
+DEPFLAGS = -MT $@ -MMD -MP -MF $(DEPDIR)/$*.Td
+POSTCOMPILE = mv -f $(DEPDIR)/$*.Td $(DEPDIR)/$*.d
+
+$(BINARY_NAME): $(OBJS)
+ @echo "[LD ] $@"
+ @$(LD) $(CFLAGS) $(LDFLAGS) $^ $(LDLIBS) -o $@
+
+$(OBJDIR)/%.o: %.c $(DEPDIR)/%.d
+ @echo "[C ] $*"
+ @$(CC) $(DEPFLAGS) $(CFLAGS) -c $< -o $@
+ @$(POSTCOMPILE)
+
+$(DEPDIR)/%.d: ;
+
+.PRECIOUS: $(DEPDIR)/%.d
+
+include $(wildcard $(patsubst %,$(DEPDIR)/%.d,$(basename $(SRCS))))
+
+clean:
+ @echo "[CLN]"
+ -@rm -r $(BUILDDIR)
+ -@rm $(BINARY_NAME)
+
+disassemble: $(BINARY_NAME)
+ objdump -d $< | less
+
+symbols: $(BINARY_NAME)
+ objdump -t $< | sort | less
--- /dev/null
+/********************************************************************/
+/* Implantation d'une liste triee d'entiers */
+/********************************************************************/
+#include <stdio.h>
+#include <stdlib.h>
+
+typedef int element;
+
+typedef struct cellule {
+ element valeur;
+ struct cellule *suivant;
+} Cellule, *Liste;
+
+
+Liste ajouter_iter(element e, Liste L)
+{Cellule *pc, *p1=L, *p2=NULL;
+
+ pc = (Cellule *)malloc(sizeof(Cellule));
+ pc->valeur=e;
+ pc->suivant=NULL;
+
+ if (!L) /* liste vide */ return pc;
+
+ while (p1 && (e >= p1->valeur))
+ {p2 = p1;
+ p1 = p1->suivant;}
+
+ if (!p2) /* insertion en tete */
+ {pc->suivant = L;
+ L=pc; }
+ else /* insertion entre p2 et p1 */
+ {p2->suivant = pc;
+ pc->suivant = p1; }
+
+ return L;
+}
+
+
+int longueur_iter(Liste L)
+{
+ return 0; /* ... */
+}
+
+
+int longueur_rec(Liste L)
+{
+ /* ... */
+}
+
+
+void visualiser_iter(Liste L)
+{
+ /* ... */
+}
+
+
+void visualiser_rec(Liste L)
+{
+ /* ... */
+}
+
+
+int rechercher_iter(element e, Liste L)
+{
+ /* ... */
+}
+
+
+Liste rechercher_rec(element e, Liste L)
+{
+ /* ... */
+}
+
+
+Liste ajouter_rec(element e, Liste L)
+{
+ /* ... */
+}
+
+
+Liste supprimer_iter(element e, Liste L)
+{
+ /* ... */
+}
+
+Liste supprimer_rec(element e, Liste L)
+{
+ /* ... */
+}
+
+
+Liste inverser_iter(Liste L)
+{
+ /* ... */
+}
+
+
+Liste inverser_rec(Liste L)
+{
+ /* ... */
+}
+
+
+/****************************************************************************/
+int main()
+{
+ int x;
+ Liste L=NULL;
+ scanf("%d",&x);
+ L=ajouter_iter(x,L);
+ printf("longueur=%d\n",longueur_iter(L));
+ visualiser_iter(L);
+ /* ... */
+}
+/****************************************************************************/
+
--- /dev/null
+# Sample Makefile to build simple project.
+#
+# This Makefile expect all source files (.c) to be at the same level, in the
+# current working directory.
+#
+# It will automatically generate dependencies, compile all files, and produce a
+# binary using the provided name.
+#
+# Set BINARY_NAME to the name of the binary file to build.
+# Set BUILD_TYPE to either debug or release
+#
+# Automatic dependencies code from:
+# http://make.mad-scientist.net/papers/advanced-auto-dependency-generation/#tldr
+BINARY_NAME=pile_chainee
+BUILD_TYPE=debug
+
+# ====================================
+# DO NOT CHANGE STUFF BEYOND THIS LINE
+# ====================================
+
+all: $(BINARY_NAME)
+
+CC=gcc
+LD=gcc
+
+WARN_FLAGS = -Wall -Wextra
+STD_FLAG = -std=c99
+
+ifeq ($(BUILD_TYPE),debug)
+BUILDDIR := .build/debug
+DEBUG_FLAG = -g
+STRIP_FLAG =
+OPTI_FLAG = -O0
+else
+BUILDDIR := .build/release
+DEBUG_FLAG =
+STRIP_FLAG = -s
+OPTIFLAG = -O3
+endif
+
+CFLAGS := $(CFLAGS) $(WARN_FLAGS) $(STD_FLAG) $(OPTI_FLAG) $(DEBUG_FLAG)
+LDFLAGS := $(LDFLAGS) $(STRIP_FLAG)
+
+OBJDIR := $(BUILDDIR)/objs
+$(shell mkdir -p $(OBJDIR))
+
+SRCS=$(wildcard *.c)
+OBJS=$(patsubst %.c,$(OBJDIR)/%.o,$(SRCS))
+
+DEPDIR := $(BUILDDIR)/deps
+$(shell mkdir -p $(DEPDIR))
+DEPFLAGS = -MT $@ -MMD -MP -MF $(DEPDIR)/$*.Td
+POSTCOMPILE = mv -f $(DEPDIR)/$*.Td $(DEPDIR)/$*.d
+
+$(BINARY_NAME): $(OBJS)
+ @echo "[LD ] $@"
+ @$(LD) $(CFLAGS) $(LDFLAGS) $^ $(LDLIBS) -o $@
+
+$(OBJDIR)/%.o: %.c $(DEPDIR)/%.d
+ @echo "[C ] $*"
+ @$(CC) $(DEPFLAGS) $(CFLAGS) -c $< -o $@
+ @$(POSTCOMPILE)
+
+$(DEPDIR)/%.d: ;
+
+.PRECIOUS: $(DEPDIR)/%.d
+
+include $(wildcard $(patsubst %,$(DEPDIR)/%.d,$(basename $(SRCS))))
+
+clean:
+ @echo "[CLN]"
+ -@rm -r $(BUILDDIR)
+ -@rm $(BINARY_NAME)
+
+disassemble: $(BINARY_NAME)
+ objdump -d $< | less
+
+symbols: $(BINARY_NAME)
+ objdump -t $< | sort | less
--- /dev/null
+/***************************************************************
+ Implantation d'un type Pile d'entiers sous forme chaînée
+ La pile est représentée par un pointeur.
+ La pile vide est représentée par NULL.
+****************************************************************/
+
+#include<stdio.h>
+#include<stdlib.h>
+
+typedef int element;
+
+typedef struct cellule
+{
+ element valeur;
+ struct cellule *suivant;
+} Cellule, *Pile;
+
+
+Pile pile_vide(void)
+{
+}
+
+int est_vide(Pile p)
+{
+}
+
+element sommet(Pile p)
+/* ATTENTION: consulter le sommet d'une pile vide n'a pas de sens */
+{
+ /* la pile n'est pas modifiée */
+}
+
+Pile empiler(element e, Pile p)
+{
+}
+
+Pile depiler(Pile p)
+/* ATTENTION: supprimer le sommet d'une pile vide n'a pas de sens */
+{
+}
+
+element depiler2(Pile * p) /*ATTENTION: la pile est modifiée */
+/* ATTENTION: cette opération n'a pas de sens avec une pile vide */
+{
+}
+
+
+/******************************************************************************/
+int main()
+{Pile p;
+ int i;
+ p=pile_vide();
+ for (i=0; i<20; i++) p=empiler(i,p);
+ for (i=0; i<25; i++) printf("%d\n",depiler2(&p));}
+/******************************************************************************/
--- /dev/null
+# Sample Makefile to build simple project.
+#
+# This Makefile expect all source files (.c) to be at the same level, in the
+# current working directory.
+#
+# It will automatically generate dependencies, compile all files, and produce a
+# binary using the provided name.
+#
+# Set BINARY_NAME to the name of the binary file to build.
+# Set BUILD_TYPE to either debug or release
+#
+# Automatic dependencies code from:
+# http://make.mad-scientist.net/papers/advanced-auto-dependency-generation/#tldr
+BINARY_NAME=file_chainee
+BUILD_TYPE=debug
+
+# ====================================
+# DO NOT CHANGE STUFF BEYOND THIS LINE
+# ====================================
+
+all: $(BINARY_NAME)
+
+CC=gcc
+LD=gcc
+
+WARN_FLAGS = -Wall -Wextra
+STD_FLAG = -std=c99
+
+ifeq ($(BUILD_TYPE),debug)
+BUILDDIR := .build/debug
+DEBUG_FLAG = -g
+STRIP_FLAG =
+OPTI_FLAG = -O0
+else
+BUILDDIR := .build/release
+DEBUG_FLAG =
+STRIP_FLAG = -s
+OPTIFLAG = -O3
+endif
+
+CFLAGS := $(CFLAGS) $(WARN_FLAGS) $(STD_FLAG) $(OPTI_FLAG) $(DEBUG_FLAG)
+LDFLAGS := $(LDFLAGS) $(STRIP_FLAG)
+
+OBJDIR := $(BUILDDIR)/objs
+$(shell mkdir -p $(OBJDIR))
+
+SRCS=$(wildcard *.c)
+OBJS=$(patsubst %.c,$(OBJDIR)/%.o,$(SRCS))
+
+DEPDIR := $(BUILDDIR)/deps
+$(shell mkdir -p $(DEPDIR))
+DEPFLAGS = -MT $@ -MMD -MP -MF $(DEPDIR)/$*.Td
+POSTCOMPILE = mv -f $(DEPDIR)/$*.Td $(DEPDIR)/$*.d
+
+$(BINARY_NAME): $(OBJS)
+ @echo "[LD ] $@"
+ @$(LD) $(CFLAGS) $(LDFLAGS) $^ $(LDLIBS) -o $@
+
+$(OBJDIR)/%.o: %.c $(DEPDIR)/%.d
+ @echo "[C ] $*"
+ @$(CC) $(DEPFLAGS) $(CFLAGS) -c $< -o $@
+ @$(POSTCOMPILE)
+
+$(DEPDIR)/%.d: ;
+
+.PRECIOUS: $(DEPDIR)/%.d
+
+include $(wildcard $(patsubst %,$(DEPDIR)/%.d,$(basename $(SRCS))))
+
+clean:
+ @echo "[CLN]"
+ -@rm -r $(BUILDDIR)
+ -@rm $(BINARY_NAME)
+
+disassemble: $(BINARY_NAME)
+ objdump -d $< | less
+
+symbols: $(BINARY_NAME)
+ objdump -t $< | sort | less
--- /dev/null
+/***********************************************************************
+ Implantation d'un type File d'entiers sous forme chaînée
+
+ La file est représentée par un doublet tête-queue de pointeurs
+ vers une cellule.
+ Le pointeur "tête" contient l'adresse de la tête de la file.
+ Le pointeur "queue" contient l'adresse de la queue de la file.
+ La file vide est représentée par le doublet NULL-NULL
+
+ Chaque cellule pointe vers la cellule suivante de la file
+ ou vers NULL si on est en queue de file.
+***********************************************************************/
+#include <stdio.h>
+#include <stdlib.h>
+
+typedef int element;
+
+typedef struct cellule
+{
+ element valeur;
+ struct cellule *suivant;
+} Cellule;
+
+typedef struct file
+{
+ Cellule *t, *q;
+} File; /* tête queue */
+
+
+File file_vide(void)
+{
+}
+
+int est_vide(File f)
+{
+}
+
+element tete(File f)
+/* ATTENTION: consulter la tête d'une File vide n'a pas de sens */
+{
+ /* la File n'est pas modifiée */
+}
+
+File enfiler(element e,File f)
+{
+}
+
+File defiler(File f)
+/* ATTENTION: supprimer la tête d'une File vide n'a pas de sens */
+{
+}
+
+element defiler2(File *f) /* ATTENTION: la File est modifiée */
+/* ATTENTION: supprimer la tête d'une File vide n'a pas de sens */
+{
+}
+
+
+/********************************************************************/
+int main()
+{File p;
+ int i;
+ p=file_vide();
+ for (i=0; i<20; i++) p=enfiler(i,p);
+ for (i=0; i<25; i++) printf("%d\n",defiler2(&p));}
+ /********************************************************************/
+
\ No newline at end of file