Advertisement
Arifin99

Doubly linklist reverse

Apr 24th, 2020
475
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.47 KB | None | 0 0
  1. void reve()
  2. {
  3.     printf("\n The reverse");
  4.     current=head;
  5.     while(current!=0)
  6.     {
  7.         next_node=current->next;
  8.         current->next=current->prev;
  9.         current->prev= next_node;
  10.         current=next_node;
  11.     }
  12.     current=head;
  13.     head=tail;
  14.     tail=current;
  15.  
  16. }
  17. void redis()
  18. {
  19.     current=head;
  20.     while(current!=0)
  21.     {
  22.         printf("[%d]\t[%d]\t[%d]\t",current,current->prev,current->data);
  23.         current=current->next;
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement