Structure and Union in C Programming

Notes:

Structure and Union in C Programming Language
- we understand difference between structure and union in c

Structure
1. while defining structures; struct keyword is used

Union
1. while defining unions; union keyword is used

Structure
2. for each member of a structure variable separate memory location is being allocated

Union
2. only one memory location is allocated for the largest member in the union and is being shared by all members in the union

Structure
3. all members of a structure variable can be accessed at a time

Union
3. only one member must be accessed at a time

Structure
4. variable length arrays are supported by structures

Union
4. variable length arrays are not supported by unions