How to declare a structure of a linked list?
The right way of declaring a structure for a linked list in a C program is
Note that the following are not correct
struct node {
int value;
struct node *next;
};
typedef struct node *mynode;
typedef struct {
int value;
mynode next;
} *mynode;
The typedef is not defined at the point where the "next" field is declared.
You can only have pointer to structures, not the structure itself as its recursive!
struct node {
int value;
struct node next;
};
typedef struct node mynode;
