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


which one is better structure or union?(other than the
space occupied )

Answers were Sorted based on User's Feedback



which one is better structure or union?(other than the space occupied )..

Answer / shrikant auti

strucure is always better than union.
there are to reasons
1.
union occupies incorrect memory.
e.g.
if the lower memory space data is preceeded by higher one.
Then memory should be alloted is addition of these two, but
the memory will be alloted will be any one out of higher
and lower there is no way to assure what memory would be
occupied.

2.
the data given in union is not necessarily be(maybe/may not
be) extreacted properly.
but in structure correct amount of memory space will be
occupied and extracting element is easy.

Is This Answer Correct ?    13 Yes 2 No

which one is better structure or union?(other than the space occupied )..

Answer / nishit jain

There is no question of which one is better. Both are there
for different functionality. Structures find more usage in
day-today programming, while unions are used less often.
There are examples where structure may not solve the purpose
but unions will work without much effort. Example :
packing-unpacking of data can be done using unions easily.

Is This Answer Correct ?    7 Yes 2 No

Post New Answer

More C Interview Questions

Why is c so important?

0 Answers  


Multiply an Integer Number by 2 Without Using Multiplication Operator

0 Answers  


What are global variables and explain how do you declare them?

0 Answers  


What is the concatenation operator?

0 Answers  


A text file that contains declarations used by a group of functions,programs,or users a) executable file b) header file c) obj file d) .cfile

0 Answers  


Write a program to print the following series 2 5 11 17 23 31 41 47 59 ...

2 Answers  


What is variable declaration and definition in c?

0 Answers  


#define DCHAR char* typedef char* TCHAR; if using these following variables will be declared like DCHAR ch1, ch2; TCHAR ch3, ch4; then what will be types of ch1, ch2, ch3 and ch4?

6 Answers   NDS,


What are the application of void data type in c?

0 Answers  


Why we use stdio h in c?

0 Answers  


Is array a primitive data type in c?

0 Answers  


How can I remove the trailing spaces from a string?

0 Answers   Aspire,


Categories