Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ITEM *list_remove (ArrayList *list, int key) {
- Node *no = list->firstNode, *tmp;
- ITEM *item = NULL;
- int i;
- while (no) {
- for (i = 0; i <= no->last; i++)
- if (no->items[i]->key == key) {
- item = no->items[i];
- while (i != no->last) {
- no->items[i] = no->items[i+1];
- i++;
- }
- no->last--;
- //list->size--;
- if (no->last == -1 && last->size != -1) {
- list->size--;
- if(no == list->firstNode)
- list->firstNode = no->next;
- else {
- tmp = list->firstNode;
- while (tmp->next != no)
- tmp = tmp->next;
- tmp->next = tmp->next->next;
- }
- }
- return item;
- }
- no = no->next;
- }
- return NULL;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement