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 structure pointer in c?
Which is best book for data structures in c?
What is strcmp in c?
What is the need of structure in c?
Is void a keyword in c?
What does the c in ctime mean?
Is null a keyword in c?
Is c compiled or interpreted?
Why should I use standard library functions instead of writing my own?
What is meant by operator precedence?
Explain zero based addressing.
I completed my B.tech (IT). Actually I want to develop virtual object that which will change software technology in the future. To develop virtual object what course I have to take. can I any professor to help me.
Where static variables are stored in memory in c?
What are control structures? What are the different types?
Under what circumstances does a name clash occur?