As usual, Wikipedia's article on structs is less than clear. It gives the syntax for structs as this:
[typedef] struct [struct_name]
{
    type attribute;
    type attribute2;
    /* ... */
    [struct struct_name *struct_instance;]
} [struct_name_t] [struct_instance];
- What would the typedef keyword do here?
- What does the [struct_name] mean? (Is it the name you're giving to the new struct data type?)
- What does the [struct_name_t] mean?
- what does the [struct_instance] mean? (Is it creating a single instance of the struct?)
- I presume [struct struct_name *struct_instance;]creates a pointer in the struct which would point to a second instance of the struct). Correct?
I would greatly appreciate an example: Say I have three files: main.c, sub.c and sub.h. I want to declare an instance of a struct in sub.h, and instantiate and use it it in sub.c. Say I want a Song type struct, with members char name[20] and char artist[10], and say I want to make an instance, mySong, {"Me singing", "Me"}, how would this look in sub.c and sub.h?
Thanks
 
     
     
     
    