I am a newbie at PalmOS and C so please bear with me...
I am considering moving an application to the Palm world and need to model a
tree-like structure where individual nodes on the tree contain several
properties and a 'collection' of children nodes where each child node is the
same structure as the parent. Theoretically, the tree would support an
infinite number of 'generations' of children nodes. In the VB world I would
use classes to model this behavior (the collection class in particular).
I would like to have similar functionality in my Palm version and thought of
using a declaration such as...
typedef struct
{
Char* Title;
Char* Text;
TreeNode TreeNodes[10];
}TreeNode;
... where each item in the TreeNodes array would be another 'TreeNode'. Of
course I am receiving a 'declaration syntax error' which I presume is due to
the recursive nature of this declaration. I also tried to do this in two
declarations but 'typedef 1' doesn't yet know about 'typedef 2' when
compiling so I get a similar error.
How can I best achieve the results I am looking for?? A code snippet would
be most helpful.
Also, in my initial attempt I was planning on using a fixed length array but
would like to go to a variable length scheme. How would I
achieve this?
Thanks in advance.
Lance
p.s. I am using Metrowerks CodeWarrior 8.0 demo version for this testing.
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/