Advertisement
levartolona

simple mid

Jan 11th, 2020
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.25 KB | None | 0 0
  1. void mid_elem(node_t *list)
  2. {
  3.     node_t *simple = list;
  4.     node_t *twice = list;
  5.     while(twice && twice -> next)
  6.     {
  7.         simple = simple -> next;
  8.         twice = twice -> next -> next;
  9.     }
  10.  
  11.     printf("MIDDLE IS %d", simple -> data);
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement