Guest User

Untitled

a guest
Aug 15th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.46 KB | None | 0 0
  1. typedef struct STACK_EL
  2. {
  3.     struct node *array;
  4.     struct STACK_EL *prev;
  5. }STACK_EL;
  6.  
  7.  
  8. STACK_EL *top_stack;
  9.  
  10.  
  11.  
  12. void stc_push(node *tmp_array)
  13. {
  14.  
  15.     STACK_EL *temp=malloc(sizeof(STACK_EL));
  16.    
  17.     temp->array=tmp_array;
  18.     temp->prev=NULL;
  19.    
  20.         temp->prev=top_stack;
  21.         top_stack=temp;
  22. }
  23.  
  24.  
  25.  
  26.  
  27. node *stc_pop()
  28. {
  29.     node *temp;
  30.     temp=top_stack->array;
  31.    
  32.     STACK_EL *tmp_el;
  33.     tmp_el=top_stack;
  34.    
  35.     top_stack=top_stack->prev;
  36.    
  37.     free(tmp_el);
  38.    
  39.     return temp;
  40. }
Add Comment
Please, Sign In to add comment