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 |
what is a class
Why is it so that we can have virtual constructors but we cannot have virtual destructors?
Why do we use oops?
What is OOPS and How it is different from Procedural Programming ?
23 Answers HP, Infosys, Thyrocare,
what is the difference between containership and inheritence?
What are the main differences between procedure oriented languages and object oriented languages?
9 Answers IBM, Infosys, Wipro,
Have you ever interfaced with a database?
What are the 3 principles of oop?
Write a macro for swapping integers
given a set based questions and 5 questions based on it next data sufficiciency questions 2 and 2/3 english sentence completion with options very easy and 2 synononmys paragraph with 10 questions 10 minutes replace =,-,*,% with -,%,+,* type questions 5 3 questions lik following itssickhere itssickthere itssickhere istsickhere which is nt alike the others very easy
different types of castings
What is a scope operator and tell me its functionality?