Define the difference between union and structure
The main difference between union and structure is the storage allocation. In Union , for each variable the compiler allocates a piece of storage that can accommodate the largestof the specified member. For example, consider the above structure is redefined as a 'union'.
union stud{
} student;
char name[15];
int regno;
char address[40];
Here the compiler allocates a storage that can accommodate 'address'. All the other variables in the structure share that location. i.e., name and reg.no values are stored in the same location where the address was stored.
But in structure each variable allocates it own storage area.