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 is the c language function prototype?
Can you write the function prototype, definition and mention the other requirements.
Hai,I have done with my bachelor of commerce and planing to ms,please suggest me how to convince vo for shifting from commerce to computers. Visa on 8 DEC 2014 Npu university
What are local static variables?
Take an MxN matrice from user and then sum upper diagonal in a variable and lower diagonal in a separate variables. Print the result
i have to apply for the rbi for the post of officers. i need to know abt the entrance questions whether it may be aps or techinical....
Why is it that not all header files are declared in every C program?
Do pointers store the address of value or the actual value of a variable?
How do I round numbers?
What is preprocessor with example?
How do we make a global variable accessible across files? Explain the extern keyword?
Do you know the purpose of 'register' keyword?
What is local and global variable in c?
Explain can the sizeof operator be used to tell the size of an array passed to a function?
What is an example of structure?