Problem with defining a linked list in C

Status
Not open for further replies.

rose_mary

Banned
Joined
Oct 17, 2005
Messages
0
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,280
Activity points
0
hi room,

I can't seem to define a linked list successfully. I tried

typedef struct {
char *item;
NODEPTR next;
} *NODEPTR;

but the compiler gave me error messages. Can't a structure in C contain a pointer to itself?
pls someone answer me soon.
 

C question?

rewrite like this

typedef struct tnode{
char *item;
struct tnode *next;
} *NODEPTR;
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…