Structure and Union
C Programming Structure and Union Quiz
Structure :
Structure is a collection of (Homogeneous ) Date Items of Different Type, It collects a Unique name, Structure using the Keyword Struct
Declaration of Structure :
Struct Name
{
Type 1 Data 1;
type 2 Data 2;
.
.
.
Type n Data n;
}
Example :
Struct student
{
Int Reg-No;
Char Name[30];
Int Semester[20];
}
Union :
Union is a collection of Heterogeneous elements using the Keyword Union, C Programming Structure and Union Quiz
Declaration of Union:
Union union-name
{
Datatype 1 Item 1;
Datatype 2 Item 2;
.
.
.
Datatype n Item n;
}
Example :
Union Number
{
Char Name[30];
Int Semester[20];
}