explain about storage of union elements.
Answers were Sorted based on User's Feedback
Answer / anandi
Union elements can share the common memory spaces.
For eg.
union stu
{
int rno;
int mark;
float total;
};
In this pg, the compiler allocates 4 bytes to store the
union members. Bcoz, in this pg, the float data type only
requires the large memory size, ie, 4 bytes. And the
remaining members can share this 4 bytes. So if u want to
store rno, it will allocate the first 2 bytes.
And also we can store only one value at a time to the
memory.
| Is This Answer Correct ? | 6 Yes | 0 No |
What is a scope resolution operator in c?
What is equivalent to ++i+++j?
What is this infamous null pointer, anyway?
How can I sort more data than will fit in memory?
program to find out date after adding 31 days to a date in the month of febraury also consider the leap year
Why & is used in c?
Convert a distance from miles to kilometers .there are 5280 feets per mile,12 inches per foot .2.54 centimeters per inch and 100000centimeters per kilometer
How can I make sure that my program is the only one accessing a file?
What is volatile keyword in c?
Write a program in c to input a 5 digit number and print it in words.
What is assert and when would I use it?
What are the phases in s/w developed life cycle? wat is the diff b/w stack & queue...where do we use stack