Ajout union
This commit is contained in:
parent
4805fe44c5
commit
20974fba6d
2 changed files with 13 additions and 3 deletions
|
@ -36,7 +36,7 @@ void init(struct pile ** une_pile) {
|
|||
*une_pile = (struct pile *)malloc(sizeof(struct pile));
|
||||
}
|
||||
|
||||
void push(int e, struct pile * une_pile) {
|
||||
void push(Valeur e, struct pile * une_pile) {
|
||||
struct cell * aux;
|
||||
if (une_pile->taille == 0) {
|
||||
une_pile->taille = 1;
|
||||
|
|
14
PILE/pile.h
14
PILE/pile.h
|
@ -1,8 +1,18 @@
|
|||
#ifndef PILE_H
|
||||
#define PILE_H
|
||||
|
||||
enum Type_t {reel,entier};
|
||||
|
||||
typedef struct Valeur{
|
||||
union
|
||||
{
|
||||
int valentier;
|
||||
float valreel;
|
||||
}val;
|
||||
enum Type_t type;
|
||||
}Valeur;
|
||||
struct cell {
|
||||
int val;
|
||||
Valeur val;
|
||||
struct cell * suiv;
|
||||
};
|
||||
|
||||
|
@ -13,7 +23,7 @@ struct pile {
|
|||
|
||||
void init(struct pile ** une_pile);
|
||||
int pop(struct pile * une_pile);
|
||||
void push(int e, struct pile * une_pile);
|
||||
void push(Valeur e, struct pile * une_pile);
|
||||
void print(struct pile une_pile);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue