explain about storage of union elements.

Answers were Sorted based on User's Feedback



explain about storage of union elements...

Answer / saranya

union elements share common memory space

Is This Answer Correct ?    18 Yes 0 No

explain about storage of union elements...

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

Post New Answer

More C Interview Questions

can we declare a variable in different scopes with different data types? answer in detail

3 Answers   TCS,


Sir,please help me out with the code of this question. Write an interactive C program that will encode or decode multiple lines of text. Store the encoded text within a data file, so that it can be retrieved and decoded at any time. The program should include the following features: (a) Enter text from the keyboard, encode the text and store the encoded text in a data file. (b) Retrieve the encoded text and display it in its encoded form. (c) Retrieve the encoded text, decode it and then display the decoded text. (d) End the computation. Test the program using several lines of text of your choice.

0 Answers  


Are pointers integer?

0 Answers  


How to set a variable in the environment list?

1 Answers  


can any one please explain, how can i access hard disk(physical address)? it is possible by the use of far,near or huge pointer? if yes then please explain......

0 Answers  






why to assign a pointer to null sometimes??how can a pointer we declare get assigned with a garbage value by default???

0 Answers  


struct abc { unsigned int a; char b; float r; }; struct xyz { int u; struct abc tt; }ww; ww = (struct xyz*)malloc(sizeof(struct xyz)); will the memory be allocated for the inner structure also?

1 Answers   Wipro,


n=7623 { temp=n/10; result=temp*10+ result; n=n/10 }

7 Answers   Wipro,


what is meant by c

9 Answers   INiTS,


What is the use of putchar function?

0 Answers  


how to generate sparse matrix in c

3 Answers  


how can i get this by using for loop? * ** * **** * ******

3 Answers   Excel,


Categories