Created
October 12, 2017 01:06
-
-
Save ltuozzo/706e6d6f62645601b132db94938b58d5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef __TDATO_H | |
#define __TDATO_H | |
#ifndef __MAX | |
#define __MAX 8 | |
#endif | |
typedef char TdatoC; | |
typedef int TdatoE; | |
#endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "tdato.h" | |
#ifndef __PILAE_H | |
#define __PILAE_H | |
#include "TDato.h" | |
struct pila{ | |
int Cima; | |
TdatoE Elem[__MAX]; | |
}; | |
typedef struct pila TpilaE; | |
int pllena (TpilaE *p){ | |
return p->Cima == __MAX-1; | |
} | |
int pvacia (TpilaE *p){ | |
return p->Cima == -1; | |
} | |
void pcrear(TpilaE *p){ | |
p->Cima=-1; | |
} | |
void pponer (TpilaE *p, TdatoE x){ | |
p->Cima++; | |
p->Elem[p->Cima] = x; | |
} | |
void psacar(TpilaE *p, TdatoE *x){ | |
*x = p->Elem[p->Cima]; | |
p->Cima--; | |
} | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment