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


Please Help Members By Posting Answers For Below Questions

What is fflush c++?

765


By using c++ with an example describe linked list?

792


Can I learn c++ in a week?

779


What are exceptions c++?

775


What is meant by entry controlled loop?

852


Search for: what is pair in c++?

858


What is c++ flowchart?

974


What is c++ programming language?

821


Keyword mean in declaration?

782


What is buffer and example?

702


Can create new c++ operators?

751


How the virtual functions maintain the call up?

812


Is it possible for a member function to delete the pointer, named this?

819


How can a called function determine the number of arguments that have been passed to it?

876


What is a static element?

792