Advertisement
Guest User

penis

a guest
Oct 14th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. #include <stdlib.h>
  2. #include "include/mylist.h"
  3.  
  4. void my_rev_list(linked_list_t **begin)
  5. {
  6. linked_list_t *swap_one = NULL;
  7. linked_list_t *swap_two = NULL;
  8. int first = 1;
  9. int last = my_list_size(*begin);
  10.  
  11. while (first <= last) {
  12. swap_one = *begin;
  13. swap_two = *begin;
  14. for (int i = 1; i < first; ++i)
  15. swap_one = swap_one->next;
  16. for (int i = 1; i < last; ++i)
  17. swap_two = swap_two->next;
  18. void *tmp = swap_one->data;
  19. swap_one->data = swap_two->data;
  20. swap_two->data = tmp;
  21. first++;
  22. last--;
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement