the definition is circular I need to define edge in terms of node and node interms of edge?
how do I do it please?
Code:typedef struct
{
int nWeight;
node *Sibling;
}edge;
typedef struct
{
char Name[100];
edge e[100];
} node;
Printable View
the definition is circular I need to define edge in terms of node and node interms of edge?
how do I do it please?
Code:typedef struct
{
int nWeight;
node *Sibling;
}edge;
typedef struct
{
char Name[100];
edge e[100];
} node;
It won't compile bcoz node is used before definition. So, forward declaration comes to save u. Use this
struct node;
typedef struct
{
int nWeight;
node* Sibling;
}edge;
typedef struct node
{
char Name[100];
edge e[100];
}NODE ;
Now struct node has been declared before use and later defined. It works....
Be alive...
Take a look at the following FAQ...
thanks