Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void sa(linked_list_t **head)
- {
- char *temp = (*head)->value;
- (*head)->value = (*head)->next->value;
- (*head)->next->value = temp;
- return;
- }
- void ra(linked_list_t **head)
- {
- if (!*head || !(*head)->next) {
- return;
- }
- linked_list_t **pp = &(*head)->next;
- while (*pp && (*pp)->next)
- pp = &(*pp)->next;
- linked_list_t *tmp = *head;
- *head = *pp;
- *pp = tmp;
- (*head)->next = (*pp)->next;
- (*pp)->next = NULL;
- return;
- }
- void pa(linked_list_t *head, linked_list_t *head2)
- {
- while (head->next != NULL) {
- head = head->next;
- }
- char *tmp = head->value;
- if (!head2 || !head2->next) {
- push_list(&head2, node_create(tmp));
- return;
- }
- while (head2->next != NULL) {
- head2 = head2->next;
- }
- push_list(&head2, node_create(tmp));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement