difference between structure and union.

Answer Posted / siva sankari

struct employee
{
int a[20];// for tis size 20 was allocated in memory
char text;// for tis only 1byte of memory space is allocated
}
so totally 21 in size was allocated in memory space

union employee
{
int a[20];// for tis size 20 was allocated in memory
char text;// for tis only 1byte of memory space is allocated
}
but in union it takes only the maximum memory space so for each 20space totally 40 size was allocated in memory space

Is This Answer Correct ?    7 Yes 12 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is difference between class and object with example?

562


What is polymorphism explain?

686


What is difference between abstraction and encapsulation?

592


What is polymorphism in oop example?

513


Is react oop?

607






What does oop mean in snapchat?

680


Prepare me a program for the animation of train

1996


What is polymorphism and types?

598


What are the three parts of a simple empty class?

1457


Why do we need oop?

664


What is property in oops?

565


How can you overcome the diamond problem in inheritance?

765


Why do we need polymorphism in c#?

684


What are the advantages of polymorphism?

573


What is polymorphism used for?

566