Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

  item** find_parent(item** list, item* item) {
    item** potential_parent = list;
    while(*potential_parent != item) {
      potential_parent = &(*potential_parent)->next;
    }
    return potential_parent;
  }
  
  void remove_item(item** list, item* item) {
    item** parent = find_parent(list, item);
    *parent = item->next;
  }


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: