2012-02-12 This is how you can effectively create a single-linked list by *appending* entries: node *head = NULL, *elem; char *str; while (str = getnextstr()) { elem = getelem(str); if (!head) { head = elem; elem->next = elem; } else { elem->next = head->next; head->next = elem; head = elem; } } head = elem->next; elem->next = NULL; The clue is to store the pointer to the beginning of the list al- ways in the last entry's next pointer. Note that you cannot use the list until you've done the finishing (last two lines). Thus, this technique can only be used if you finish building the list completely before you start accessing it. Also, there `elem' needs to be set *inside* the loop, not in the condition. You see, this is a special-case optimization. You won't see this one often and that's good. It likely causes errors: People won't recognize it quickly. The identifiers `head' changes its meaning between ``tail'' and ``head''. The limiting conditions might change, possibly making the algorithm unusable. It's good to have seen such an implementation to recognize it when you came across it, but please dont implement it yourself this way. At least not without an explaining comment (only bad algorithm choices need this). If you want to append to single- linked lists, then use a separate `tail' pointer. http://marmaro.de/lue/ markus schnalke