Popular Posts

Saturday, July 19, 2008

DIFFERENCE BETWEEN STRUCT AND UNION

DIFFERENCE BETWEEN STRUCT AND UNION:

In structures,each member has its own storage location,whereas all memebers of a union use
the same location.this implies that,although a union may contain many members of different types,it can handle only one member at a time.

ex: struct book
{
char title[20];
char author[15];
int pages;
float price;
}
ex: union item
{
int m;
float x;
char c;
}code;

No comments:

Post a Comment