B
Ben
Hi,
I am trying to create a specific structure, but having problems with
the type definitions.
Basically it's an array of trees. Each element of the array should be a
binary tree of type TREE.
TREE is a pointer to a node TREENODE of the tree which containers
pointers to the children.
typedef struct TREENODE *TREE;
struct TREENODE {
USERID uid;
TREE leftChild, rightChild;
};
/* Array of Tree pointers */
typedef struct TREE USERBASE[100];
The array is important since the index provides infomation about the
what nodes are in the tree.
The tree definition looks and seems to work fine, but my functions
refer to a TREE by referring to an element of the ARRAY. I think this
part may be breaking. The program compiles and runs fine, and it seems
I can initialise elements of the array and add nodes, but the nodes
don't appear to have been created when I try to extract info - all are
NULL.
What do I need to do to allow the array to properly point to a TREE or
do I need to refer to the elements in a particular way (my functions
don't use * or & etc.)?
cheers
I am trying to create a specific structure, but having problems with
the type definitions.
Basically it's an array of trees. Each element of the array should be a
binary tree of type TREE.
TREE is a pointer to a node TREENODE of the tree which containers
pointers to the children.
typedef struct TREENODE *TREE;
struct TREENODE {
USERID uid;
TREE leftChild, rightChild;
};
/* Array of Tree pointers */
typedef struct TREE USERBASE[100];
The array is important since the index provides infomation about the
what nodes are in the tree.
The tree definition looks and seems to work fine, but my functions
refer to a TREE by referring to an element of the ARRAY. I think this
part may be breaking. The program compiles and runs fine, and it seems
I can initialise elements of the array and add nodes, but the nodes
don't appear to have been created when I try to extract info - all are
NULL.
What do I need to do to allow the array to properly point to a TREE or
do I need to refer to the elements in a particular way (my functions
don't use * or & etc.)?
cheers