Question about C
I am trying to make a typedef struct like this
typedef struct
{
NODE* child;
NODE* parent;
NODE* next;
int nParents;
BOOL visible;
}NODE;
but obviously i cant refer to NODE before it is declared. is there anything i can put before the struct so it will know i am going to declare NODE eventually.
I am used to c++ where i can just do
struct NODE
{
NODE* child;
NODE* parent;
NODE* next;
int nParents;
BOOL visible;
};
and it works fine. but i have to use c for what i am doing, so please help. thanks in advance.
Rodger
struct NODE;void Func(struct NODE *);typedef struct NODE { int Magic;} NODE;
i need the NODE type to be used within the NODE struct. That code doesnt work for it.
Rodger
I am no C programmer, but how about
typedef struct NODETYPE{ struct NODETYPE* next;} NODE;
quote: Original post by robirt
what do you mean by ''cast'' it as a (NODE *)?
I suggest don''t do it this way. Follows Miserable''s way.
"after many years of singularity, i'm still searching on the event horizon"
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement