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 |
Can the sizeof operator be used to tell the size of an array passed to a function?
suppose there are five integers write a program to find larger among them without using if- else
Explain two-dimensional array.
write a C code to reverse a string using a recursive function, without swapping or using an extra memory.
9 Answers Motorola, TCS, Wipro,
what is the difference b/w NULL and null?
Differentiate between the = symbol and == symbol?
What is Full Form of C and Why We use C
what is structuer?
WAP to accept basic salary of an employee? Calculate it HRA=25%,DA=30%,PF=30%&net salary display all contents?
6 Answers Finite Infotech, Lovely Professional University, Wipro,
what is difference between procedural language and functional language ?
to convert a string without using decrement operater and string functions
What will be the result of the following program? main() { char p[]="String"; int x=0; if(p=="String") { printf("Pass 1"); if(p[sizeof(p)-2]=='g') printf("Pass 2"); else printf("Fail 2"); } else { printf("Fail 1"); if(p[sizeof(p)-2]=='g') printf("Pass 2"); else printf("Fail 2"); } } a) Pass 1, Pass 2 b) Fail 1, Fail 2 c) Pass 1, Fail 2 d) Fail 1, Pass 2 e) syntax error during compilation