User defined data types
Structures
and
Unions.
Standalone variables of primitive types are not sufficient enough to handle real world problems.
It is often required to group logically related data items together.
Unions are conceptually similar to structures as they allow us to group together dissimilar type elements inside a single unit.
However the size of union is equal to size of its largest number element.
Eg:
union result
{
int marks;
char grade;
float percent;
};
Structures
and
Unions.
Standalone variables of primitive types are not sufficient enough to handle real world problems.
It is often required to group logically related data items together.
Unions are conceptually similar to structures as they allow us to group together dissimilar type elements inside a single unit.
However the size of union is equal to size of its largest number element.
Eg:
union result
{
int marks;
char grade;
float percent;
};
No comments:
Post a Comment