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

What is the function of ceil(X) defined in math.h do? A)It returns the value rounded down to the next lower integer B)it returns the value rounded up to the next higher integer C)the Next Higher Value D)the next lower value

3 Answers   Accenture, Wipro,


Write a program that takes a 5 digit number and calculates 2 power that number and prints it

7 Answers  


Write a program which returns the first non repetitive character in the string?

0 Answers   Expedia,


I just typed in this program, and it is acting strangely. Can you see anything wrong with it?

0 Answers  


how many types of operators are include in c language a) 4 b) 6 c) 8 d) 12

0 Answers  






Why do we use int main?

0 Answers  


What is the ANSI C Standard?

0 Answers   Celstream,


about c language

0 Answers  


what is the output of the program and explain why?? #include<stdio.h> void main ( ) { int k=4,j=0: switch (k) { case 3; j=300; case 4: j=400: case 5: j=500; } printf (“%d\n”,j); }

14 Answers   Oracle,


what is output? main() { #define SQR(x) x++ * ++x int i = 3; printf(" %d %d ",SQR(i),i * SQR(i)); } a)9 27 b)35 60 c)20 60 d)15 175

5 Answers   Wipro,


Write a function that accepts a sentence as a parameter, and returns the same with each of its words reversed. The returned sentence should have 1 blank space between each pair of words. Demonstrate the usage of this function from a main program. Example: Parameter: “jack and jill went up a hill” Return Value: “kcaj dna llij tnew pu a llih”

5 Answers   Mind Tree,


What are the different types of errors?

0 Answers  


Categories