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
Define stacks. Provide an example where they are useful.
What is lambda expression c++?
Explain the difference between struct and class in terms of access modifier.
Which field is used in c++?
What is c++ library?
Why is the function main() special?
Why do we use setw in c++?
Which software is best for programming?
What is meant by forward referencing and when should it be used?
Explain the scope of resolution operator.
What is c++ vb?
What is the main function c++?
What is class syntax c++?
What are the data types in c++?
If you hear the cpu fan is running and the monitor power is still on, but you did not see anything show up in the monitor screen. What would you do to find out what is going wrong?