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
Explain function overloading and operator overloading.
Can I learn c++ without knowing c?
What is the sequence of destruction of local objects?
What is the use of volatile variable?
Can a list of string be stored within a two dimensional array?
What is meant by entry controlled loop? What all C++ loops are exit controlled?
Is it possible to use a new for the reallocation of pointers ?
Why iomanip is used in c++?
What is an iterator class in c++?
Is c++ a good beginners programming language?
What is the use of endl in c++ give an example?
What are manipulators used for?
how to access grid view row?
Why do we use pointers in c++?
What is the difference between ++ count and count ++?