mihainan

Untitled

Apr 2nd, 2014
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 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 = val;
  25. l->next = NULL;
  26. }
  27. else
  28. {
  29. nou=(Element *)malloc(sizeof(Element));
  30. temp=l;
  31. while(temp->next!=NULL)
  32. temp=temp->next;
  33. nou->sir=val;
  34. nou->next=NULL;
  35. nou->prev=temp;
  36. temp->next=nou;
  37. }
  38. return l;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment