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 / ranjeet garodia
Jaroosh u r right while calculating the size...
but if u take size of int as 2 then astruct size will be
2+4+2=8
array = 1*10= 10
so c is correct
if size of int is 4, then
struct size will be 4+4+4= 12
then a is correct.
| Is This Answer Correct ? | 1 Yes | 11 No |
Post New Answer View All Answers
Write some differences between an external iterator and an internal iterator? Describe the advantage of an external iterator.
What is endianness?
Can we run c program in turbo c++?
What is an overflow error?
What are the two types of comments, and how do they differ?
What operator is used to access a struct through a pointer a) >> b) -> c) *
What is the exit function in c++?
How can I learn c++ easily?
List the issue that the auto_ptr object handles?
What is constructor and destructor in c++?
Can a function take variable length arguments, if yes, how?
Can constructor be private in c++?
Which field is used in c++?
What is the object serialization?
What is the use of map in c++?