Advertisement
Guest User

Untitled

a guest
Feb 13th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.40 KB | None | 0 0
  1.  void revert(struct node **root) {
  2.      //jednoprvkovy
  3.      if((*root)->next == NULL)
  4.          return;
  5.  
  6.      //dvoj a viac prvkovy
  7.      struct node *act = *root;
  8.      struct node *previous = NULL;
  9.      struct node *nxt;
  10.      while(act->next != NULL) {
  11.          nxt = act->next;
  12.          act->next = previous;
  13.          previous = act;
  14.          act = nxt;
  15.      }
  16.      *root = act;
  17.          
  18.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement