|
-
December 9th, 2004, 12:45 AM
#1
type def question
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;
-
December 9th, 2004, 01:09 AM
#2
Re: type def question
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...
Mukesh Vijay
-
December 9th, 2004, 04:01 AM
#3
Re: type def question
Take a look at the following FAQ...
-
December 9th, 2004, 06:17 AM
#4
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|