When you typedef a variable, you are defining a new type. This does not create an instance of it. Watch:
Code:
struct
{
... stuff here ...
} instance;
This defines a nameless structure, and creates an instance of it, called 'instance'.
You cannot individually define instances of this structure now, because it has no name.
Code:
struct mystruct
{
... stuff here ...
} instance;
struct mystruct another_instance;
This defines a names structure (mystruct) and also creates an instance. We then create a second instance since it is named.
Code:
typedef struct
{
... stuff here ...
} node;
node instance;
Define a new data type named 'node' from a nameless structure. We then have to seperately define an instance of it.
Code:
typedef struct named
{
... stuff here ...
} node;
node instance;
struct named anotherinstance;
As per above, except we have created instances two different ways.
Key point here: the tag on the end of a typedef is the name of the data type, not the name of the instance of the variable.
Quzah.