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

Without the container struct, you'd have to pass the pointer to the pointer of the first element, remove(&head, elem), or assign the return value back to it, head = remove(head, elem). A container also allows you to maintain a counter and a tail pointer, for fast append and insert. Above all, a container makes it harder to return a pointer to just somewhere in the middle of the list and treat that as the head.


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

Search: