Advertisement
Guest User

Untitled

a guest
Dec 10th, 2019
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. void sa(linked_list_t **head)
  2. {
  3. char *temp = (*head)->value;
  4. (*head)->value = (*head)->next->value;
  5. (*head)->next->value = temp;
  6. return;
  7. }
  8.  
  9. void ra(linked_list_t **head)
  10. {
  11. if (!*head || !(*head)->next) {
  12. return;
  13. }
  14. linked_list_t **pp = &(*head)->next;
  15. while (*pp && (*pp)->next)
  16. pp = &(*pp)->next;
  17. linked_list_t *tmp = *head;
  18. *head = *pp;
  19. *pp = tmp;
  20. (*head)->next = (*pp)->next;
  21. (*pp)->next = NULL;
  22. return;
  23. }
  24.  
  25. void pa(linked_list_t *head, linked_list_t *head2)
  26. {
  27. while (head->next != NULL) {
  28. head = head->next;
  29. }
  30. char *tmp = head->value;
  31. if (!head2 || !head2->next) {
  32. push_list(&head2, node_create(tmp));
  33. return;
  34. }
  35. while (head2->next != NULL) {
  36. head2 = head2->next;
  37. }
  38. push_list(&head2, node_create(tmp));
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement