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...


What is the difference b/w Structure & Union?

Answers were Sorted based on User's Feedback



What is the difference b/w Structure & Union?..

Answer / nakul sharma

Memory allocated for any structure is equal to the sum of
memory required by each structure member.

Example: In a structure 'abc' below, memory allocated will
be 7 Bytes (2 Bytes for int a + 1 Byte for char b + 4 Bytes
for float c ina 32 bit processor)
struct abc
{
int a;
char b;
float c;
}

But in union memory allocated for it is equal to the memory
required by the biggest (in terms of memory it use) union
member.

Example: In a union 'abc' below, memory allocated will be 4
Bytes as float c is the biggest union member here and it
uses 4 Bytes of memory in 32 bit processor.

union abc
{
int a;
char b;
float c;
}

Is This Answer Correct ?    19 Yes 1 No

What is the difference b/w Structure & Union?..

Answer / karthikkumareg

in structure struct key word is used but in union union key
word is used.

Is This Answer Correct ?    6 Yes 9 No

What is the difference b/w Structure & Union?..

Answer / raj kumar

struct can hold multiple data types.
Like u can define a date structure....
but union can multiple data types which includes struct also

union x
{
int x;
struct
{
...
...
}
}

Is This Answer Correct ?    2 Yes 7 No

Post New Answer

More C Interview Questions

What is printf () in c?

0 Answers  


Why & is used in c?

0 Answers  


In a header file whether functions are declared or defined?

0 Answers   TISL,


how can write all 1to 100 prime numbers using for loop,if and break ?

2 Answers   TCS,


What are near, far and huge pointers?

0 Answers   Hexaware, Thomson Reuters, Virtusa,


Describe the order of precedence with regards to operators in C.

0 Answers  


PROGRAM TO WRITE CONTENTS OF 1 FILE IN REVERSE TO ANOTHER FILE,PROGRAM TO COPY 1 FILE TO ANOTHER BY SPECIFYING FILE NAMES AS COMMAND LINE

0 Answers  


What is assert and when would I use it?

0 Answers  


What does %p mean c?

0 Answers  


Differentiate between a for loop and a while loop? What are it uses?

0 Answers   TISL,


What does do in c?

0 Answers  


When should you use a type cast?

0 Answers  


Categories