say I have:
and I want to create an array of TreeNode, how do I do that?Code:typedef struct treeNode
{ ..................
.......................
} TreeNode;
Printable View
say I have:
and I want to create an array of TreeNode, how do I do that?Code:typedef struct treeNode
{ ..................
.......................
} TreeNode;
We'll give you three guesses, first two don't count.
No really. Go to your compiler, and try three things. If you don't get one of them right, then tell us what you tried and we'll go over it.
Can I try ? :)
Here's a secret: You can do this
You do not need to specify the number of elements in *TreeNode when you declare it, but as with a *char, you need to malloc (and possibly realloc) enough space for it. Multiply by sizeof(*TreeNode).Code:typedef struct treeNode
{ ..................
.......................
} *TreeNode;
Typedefing pointers can come back to haunt you later. Avoid it, is my advice.
What is so hard about typing out a lone *?