difference between structure and union.
Answers were Sorted based on User's Feedback
Regarding the struct, each item in the struct is allocated
in a separated memory. And the size of a struct object is
total size of all its items.
But with the union, all its items are in the same memory.
And the size of an union object is size of its item which
has largest size.
| Is This Answer Correct ? | 24 Yes | 0 No |
Answer / siva sankari
struct employee
{
int a[20];// for tis size 20 was allocated in memory
char text;// for tis only 1byte of memory space is allocated
}
so totally 21 in size was allocated in memory space
union employee
{
int a[20];// for tis size 20 was allocated in memory
char text;// for tis only 1byte of memory space is allocated
}
but in union it takes only the maximum memory space so for each 20space totally 40 size was allocated in memory space
| Is This Answer Correct ? | 7 Yes | 12 No |
define a string class. overload the operator == to compare two strings
2 Answers Birla, Ericsson, HCL, Infosys, Infotech, MCAS, Satyam,
what is multi level inheritance give n example ?
13 Answers HDFC, Hulas Steel, Ness Technologies,
What is a class?
32 Answers Infosys, TCS, Thylak,
What is the difference between static polymorphism and dynamic polymorphism?
Write an operator overloading program to write S3+=S2.
why overriding?
Which is not an object oriented programming language?
Can we create object of class with private constructor?
what is polymorphism?
what is abstract class ? when is used in real time ? give a exp
Can we create object of abstract class?
How do you explain polymorphism?