Which uses less memory?
a)
struct astruct
{
int x;
float y;
int v;
};
b)
union aunion
{
int x;
float v;
};
c)
char array[10];
Answer Posted / jaroosh
And the explanation for the above answer is :
union has the size of the biggest type of its member, so
here its size is 4, while structs size is 4 + 4 + 4 = 16,
and arrays size is 1 * 10 = 10.
Is This Answer Correct ? | 10 Yes | 0 No |
Post New Answer View All Answers
What are the five basic elements of a c++ program?
Snake Game: This is normal snake game which you can find in most of the mobiles. You can develop it in Java, C/C++, C# or what ever language you know.
What is a container class? What are the types of container classes in c++?
How do I write a c++ program?
Explain about vectors in c ++?
Is recursion allowed in inline functions?
How a modifier is similar to mutator?
What is the standard template library (stl)?
What are the operators in c++?
Why is swift so fast?
What is the keyword auto for?
What are activex and ole?
What is function overloading in C++?
what are the iterator and generic algorithms.
Explain some examples of operator overloading?