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
Explain what is the difference between null and nul?
What does nil mean in c?
Write program to remove duplicate in an array?
write a program that declares an array of 30 elements named "income" in the main functions. then cal and pass the array to a programmer-defined function named "getIncome" within the "getIncome" function, ask the user for annual income of 30 employees. then calculate and print total income on the screen using the following function: "void getIncome ( ai []);
What is the difference between a function and a method in c?
What should malloc() do? Return a null pointer or a pointer to 0 bytes?
Why is a semicolon (;) put at the end of every program statement?
Create a structure to specify data on students as given below: Roll number, Name, Department, Course, and Year of joining. Assume that there are not more than 450 students in the collage. (a) Write a function to print the names of all students who joined in the last 3 years. (b) Write a function to print the data of a student whose roll numbers are divisible by 4.
Is there any demerits of using pointer?
How would you obtain the current time and difference between two times?
PLS U SENS ME INTERVIEW O. MY EMAIL ADD, SOFIYA.SINGH@GMAIL.COM
Explain what are multibyte characters?
write a proram to reverse the string using switch case?
Hai sir, I had planned to write the NIC scientific engineer exam , plz post the sample question......
Explain what is meant by high-order and low-order bytes?