I'm trying to create a linked list, and due to the lack of support of 'typdef struct' I'm having trouble determining how I should code the list.
Here is some sample code which is similar to what I'm trying to do.
struct node
{
char a;
node *next;
};
typedef struct node *head;
int main()
{
head na;
na = new node;
//na-> //This line doesn't display any members of the node struct.
}
Are there any workarounds to the typedef struct problem? Or am I just not defining 'node' and 'head' correctly?
Thanks
If you insist to name a typedef different than the struct (why?)
The reason I want to name the typedef different than the struct is to create a type that is a pointer to the struct type.
From my example:
struct node
{
char a;
node *next;
};
typedef struct node *head;
'head' is a pointer to the 'node' type. I guess my question is: Is there any way to create a type that's a pointer to the struct?
Thanks again. I appreciate your help Morten.