Sunday, 15 September 2013

Unable to get this data structure to work (newbie)

Unable to get this data structure to work (newbie)

I'm pretty new to C, and I've been trying to make a program with this data
structure:
struct node {
char command[100];
char prereq[100][80];
char *targ;
int isUpdated;
} Node;
However, whenever I try to implement it in the code, like this:
Node n = malloc(sizeof(*n));
I get compiler errors such as "nmake.c:13:31: error: unknown type name
'Node'".
I've tried code such as:
typedef struct node *Node;
with similar results. What's wrong?

No comments:

Post a Comment