juan_de99

Untitled

Oct 22nd, 2021
558
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /// .h pila dinamica
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #include <string.h>
  5.  
  6. #define MINIMO(X,Y) (X)<(Y)?(X):(Y)
  7.  
  8. typedef struct s_nodo
  9. {
  10.     void *dato;
  11.     unsigned tam;
  12.     struct s_nodo *sig;
  13. }t_nodo;
  14.  
  15. typedef t_nodo* t_pila;
  16.  
  17.  
  18. void crearPila(t_pila *p);
  19. int desapilar(t_pila *p,unsigned tam,void *dato);
  20. int apilar(t_pila *p,unsigned tam,const void *dato);
  21. int verTope(const t_pila *p,unsigned tam,void *dato);
  22. int pilaVacia(const t_pila *p);
  23. int pilaLlena(const t_pila *p, unsigned tam);
  24. void vaciarPila(t_pila *p);
  25.  
  26. /// .c
  27.  
  28. #include <stdio.h>
  29. #include <stdlib.h>
  30. #include <string.h>
  31.  
  32. #define MINIMO(X,Y) (X)<(Y)?(X):(Y)
  33.  
  34. typedef struct s_nodo
  35. {
  36.     void *dato;
  37.     unsigned tam;
  38.     struct s_nodo *sig;
  39. }t_nodo;
  40.  
  41. typedef t_nodo* t_pila;
  42.  
  43.  
  44. void crearPila(t_pila *p);
  45. int desapilar(t_pila *p,unsigned tam,void *dato);
  46. int apilar(t_pila *p,unsigned tam,const void *dato);
  47. int verTope(const t_pila *p,unsigned tam,void *dato);
  48. int pilaVacia(const t_pila *p);
  49. int pilaLlena(const t_pila *p, unsigned tam);
  50. void vaciarPila(t_pila *p);
RAW Paste Data