Advertisement
Guest User

Untitled

a guest
Mar 18th, 2016
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.51 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct LIST{
  5.     int value;
  6.     struct LIST *next;
  7. };
  8. LIST *GetTail(LIST *head){
  9.     if(!head)
  10.      return NULL;
  11.     while(head->next != NULL)
  12.      head = head->next;
  13.     return head;
  14. }
  15. void AddEl(LIST *head, int value){
  16.     LIST *newEl = new LIST;
  17.     newEl->value = value;
  18.     newEl->next = NULL;
  19.     if(!head)
  20.      head = newEl;
  21.     else
  22.     {
  23.         head = GetTail(head);
  24.         head->next = newEl;
  25.     }
  26. }
  27.  
  28. int main()
  29. {
  30.     LIST *head = NULL;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement