Guest User

Untitled

a guest
Dec 7th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. static void remove_list_element(line *list_head, unsigned int index) {
  2. line *pre = NULL;
  3. line *post= NULL;
  4. line *elem= list_head;
  5. unsigned int i = 0;
  6.  
  7. if(index > 1) {
  8. for(i = 1; i < index; i++) {
  9. pre = elem;
  10. elem = elem->next;
  11. post = elem->next;
  12. }
  13.  
  14. crFree(elem);
  15.  
  16. pre->next = post;
  17. }else{
  18. pre = list_head;
  19. list_head = list_head->next;
  20.  
  21. crFree(pre);
  22. }
  23. }
Add Comment
Please, Sign In to add comment