Y
yezi
hi all :
I have question regarding to the structure which include an other
structure .
typedef struct routingTableEntry
{
int destNode;
int hopCount;
int nextNode;
int path[5];
}TABLEENTRY;
typedef struct routetable
{
struct routingTableEntry * entry;
struct routetable * next;
} ROUTETABLE;
Can I write the sentence like the following :
tmp = (ROUTETABLE*)malloc(sizeof(ROUTETABLE));
if (tmp == NULL) {
printf("Can't initialize routing table.\n");
exit(1);
}
tmp -> entry -> destNode = selfNumber;
printf("before the hopcount\n"); //Problem here
tmp -> entry -> hopCount = 0;
tmp -> entry -> nextNode = 0;
If can not , How can I assign the numbers to the sub structure?
Thanks for any comments.
bin YE
I have question regarding to the structure which include an other
structure .
typedef struct routingTableEntry
{
int destNode;
int hopCount;
int nextNode;
int path[5];
}TABLEENTRY;
typedef struct routetable
{
struct routingTableEntry * entry;
struct routetable * next;
} ROUTETABLE;
Can I write the sentence like the following :
tmp = (ROUTETABLE*)malloc(sizeof(ROUTETABLE));
if (tmp == NULL) {
printf("Can't initialize routing table.\n");
exit(1);
}
tmp -> entry -> destNode = selfNumber;
printf("before the hopcount\n"); //Problem here
tmp -> entry -> hopCount = 0;
tmp -> entry -> nextNode = 0;
If can not , How can I assign the numbers to the sub structure?
Thanks for any comments.
bin YE