mihainan

Untitled

Apr 2nd, 2014
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. typedef struct _stack {
  2. char* data;
  3. int capacity;
  4. int size;
  5. }* Stack;
  6.  
  7. typedef struct Element
  8. {
  9. struct Element *prev;
  10. Stack sir;
  11. struct Element *next;
  12. }Element;
  13.  
  14.  
  15.  
  16. typedef struct Element* Lista;
  17.  
  18. Lista addLast(Lista l, Stack val)
  19. {
  20. Lista nou, temp;
  21. if (l==NULL)
  22. {
  23. l->prev = NULL;
  24. l->sir = initStack();
  25. l->sir = val;
  26. l->next = NULL;
  27. }
  28. else
  29. {
  30. nou=(Element *)malloc(sizeof(Element));
  31. temp=l;
  32. while(temp->next!=NULL)
  33. temp=temp->next;
  34. nou->sir = initStack();
  35. nou->sir=val;
  36. nou->next=NULL;
  37. nou->prev=temp;
  38. temp->next=nou;
  39. }
  40. return l;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment