On Thu, Jul 10, 2008 at 5:39 PM, Julien Claassen <[EMAIL PROTECTED]> wrote:
> Hello again!
>   I'm sorry, but my earlier experiments don't seem worth the effort. Now I
> thought, this has all been done and perhaps someone can help me. I need a tree
> stucture in C, based on struct, where each node has a list of subnodes. like
> this:
> (root(e1(e11,e12,e13(e131,e132,e133,e134,e135)),e2)
>   If you get what I mean. Does anyone know of such a structure almost made
> ready for use? I'm sure I heard the official name for this in my lectures, but
> alas it's long ago.
>   Yes, I did consider doing this in c++, but then readline will get me down on
> my knees again and will have my crying in frustration and defeat, as it did
> last time. :-(

The usual solution is a "node" struct for each element in the tree.
It normally has two pointers, one to the first child, and one to the next
sibling.  A parent pointer may also be useful if you need to traverse the
tree starting somewhere other than the root.  Leaf nodes have a NULL
child pointer.
-- 
 joq
_______________________________________________
Linux-audio-dev mailing list
[email protected]
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-dev

Reply via email to