say I have:
and I want to create an array of TreeNode, how do I do that?Code:typedef struct treeNode { .................. ....................... } TreeNode;
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;
C programming resources:
GNU C Function and Macro Index -- glibc reference manual
The C Book -- nice online learner guide
Current ISO draft standard
CCAN -- new CPAN like open source library repository
3 (different) GNU debugger tutorials: #1 -- #2 -- #3
cpwiki -- our wiki on sourceforge