Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


difference between structure and union.

Answers were Sorted based on User's Feedback



difference between structure and union...

Answer / truong nguyen

Regarding the struct, each item in the struct is allocated
in a separated memory. And the size of a struct object is
total size of all its items.
But with the union, all its items are in the same memory.
And the size of an union object is size of its item which
has largest size.

Is This Answer Correct ?    24 Yes 0 No

difference between structure and union...

Answer / 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

More OOPS Interview Questions

What is multiple inheritance?

9 Answers   TCS,


what is abstract class ? when is used in real time ? give a exp

5 Answers  


Why is polymorphism needed?

0 Answers  


what is the difference between class and structure in C++?

9 Answers   Aspire, IBS, TCS,


In c++ there is only virtual destructors, no constructors. Why?

4 Answers   IBM, Polaris,


if u write a class do u write Assignment operator and copy constructor

1 Answers   Siemens,


what is object slicing

3 Answers   TCS,


write a program to find the largest of two numbers without using for,while,switch,if else, conditional operator and do while using c++ pgmng language

3 Answers   Satyam,


What are the different forms of polymorphism??

8 Answers   Mantaq, NUC, PCS,


what is overloading and overriding?

7 Answers  


What is polymorphism? Explain with an example.

48 Answers  


What is encapsulation oop?

0 Answers  


Categories