I have a couple of header files, which boil down to:
tree.h:
#include "element.h"
typedef struct tree_
{
struct *tree_ first_child;
struct *tree_ next_sibling;
int tag;
element *obj;
....
} tree;
element.h:
#include "tree.h"
typedef struct element_
{
tree *tree_parent;
char *name;
...
} element;
The problem I have is, that they both reference each other, so tree needs element included, and element needs tree included.
This doesn't work, to initialise the 'tree' structure, the element structure must be known about, but to initialise the element structure, the tree structure must be known about.
How do you resolve these types of loops (I think it has some thing to do with 'forward declaration'?)?