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
What is fflush c++?
By using c++ with an example describe linked list?
Can I learn c++ in a week?
What are exceptions c++?
What is meant by entry controlled loop?
Search for: what is pair in c++?
What is c++ flowchart?
What is c++ programming language?
Keyword mean in declaration?
What is buffer and example?
Can create new c++ operators?
How the virtual functions maintain the call up?
Is it possible for a member function to delete the pointer, named this?
How can a called function determine the number of arguments that have been passed to it?
What is a static element?