예전에 플갤에서 본거 같은데
remove_list_entry(entry) { prev = NULL; walk = head; //Walk the list while (walk != entry) { prev = walk; walk = walk->next; } // Remove the entry by updating the // head or the previous entry if (!prev) head = entry->next; else prev->next = entry->next; } remove_list_entry(entry) { // The "intransparent" pointer points to the // *address* of the thing we'll update intransparent = &head //Walk the list, looking for the thing that // points to the entry we want to remove while((*intransparent) != entry) intransparent = &(*indirect)->next; // .. and just remove it *indirect = entry-> next; }
함수포인터 떡칠해서 보기 힘들게 만드는게 아니라
위 함수를 아래처럼 만드는거 아닌가여?
댓글 0