which one is better structure or union?(other than the
space occupied )
Answer Posted / 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 |
Post New Answer View All Answers
What are the data types present in c?
Explain what is the difference between functions abs() and fabs()?
Explain how can I write functions that take a variable number of arguments?
What is main return c?
What is main () in c language?
Explain how can you tell whether a program was compiled using c versus c++?
pierrot's divisor program using c or c++ code
Explain the use of fflush() function?
What is c token?
Can one function call another?
Is there anything like an ifdef for typedefs?
Using functions, write a program that multiplies two arrays. Use the following functions: - Function ReadArray - Function MultiplyArrays - Function DisplayArrays
Can you return null in c?
What is typedf?
How many data structures are there in c?