Advertisement
argentinapb

Untitled

Apr 10th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. #define max 5
  4.  
  5. struct pilha{
  6. int topo;
  7. int pilha[max];
  8. }p, aux;
  9.  
  10.  
  11. void mostrar (struct pilha *p, struct pilha *aux){
  12.  
  13. if(p->topo != -1){
  14.  
  15. for(int i = 0; p->topo >= i; p->topo--, aux->topo++){
  16. printf("%d\n", p->pilha[p->topo]);
  17. aux->pilha[aux->topo] = p->pilha[p->topo];
  18.  
  19.  
  20. }
  21. for(int i = 0; aux->topo >= 0; aux->topo--){
  22. p->pilha[p->topo] = aux->pilha[aux->topo];
  23. p->topo++;
  24. }
  25. }
  26. else
  27. printf("nao ha elementos a ser mostrado\n");
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement