DEV_BUT1/DEV1.1S/TPPILE/file.c
2023-02-08 11:18:16 +01:00

34 lines
552 B
C

#include <stdio.h>
#include <stdlib.h>
struct maillon_ {
char c;
struct maillon_* next;
};
typedef struct maillon_ maillon;
typedef maillon* file;
void push(file* f, char c) {
maillon* m = calloc(1, sizeof(maillon));
m->c = c;
if (*f == NULL) {
*f = m;
} else {
file* start = f;
file ff = *f;
while (ff->next != NULL) ff = ff->next;
ff->next = m;
f = start;
}
}
char pop(file* f) {
char c = (*f)->c;
*f = (*f)->next;
}
int empty(file f) {
return f == NULL;
}