I don't use unions very often, but puttnig a group of similar variables together within a struct can be very useful. First of all, it allows you to keep track of variables within your program. The example that I usually give is that if you're trying to keep track of the number of screws you have by size, it makes sense to put those variables (half-inch, quarter-inch, etc.) in a box called "screws" so you don't confuse the number of screws with the number of bolts. This way you can have a screws.half-inch and a bolts.half-inch; everyone knows exactly what variable you're talking about just by looking at it, and there isn't any conflict.
The other argument for using a struct is the ability to typedef it to create your own complex datatypes. For example, each node in a linked list has to have at least one storage area (to hold the data), and one refference area (to point to the next node in the list). Using structs and typedefs you can make a handy node type that deals with that for you, and saves some code writing.
Code:
typdedef struct Node
{
char cell[1];
void *next;
}
We can create a new node simply be saying
At least that's my understanding of it, but there may be some parts of the picture that I'm missing too.
Hope this helps,
starX
www.axisoftime.com