Thursday, December 25, 2014

DIFFERENCE BETWEEN STRUCTURE & UNION

Structure take individual memory space for each variable while union takes largest memory space & all variable share its. 

Example of Structure
struct emp
{
 int code;
 char name[20];
 float sal;
};
intà2bytes
stringà20bytes
floatà4bytes

Total Memory occupiedà26bytes

Example of Union
union emp
{
 int code;
 char name[20];
 float sal;
};

Total Memory occupied à20bytes

No comments:

Post a Comment

Computer Network & Computer Features | Bal Varg | Computer Questions List!

  Computer Network & Computer Features 1) _______ is a thin strip like bar present at the bottom of the screen.   Taskbar 2) _______ ser...