Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

Is c++ the hardest programming language?

1131


How will you call C functions from C ++ and vice-versa?

1139


What are the basic data types used in c++?

1033


What is function declaration in c++ with example?

1096


What are the extraction and insertion operators in c++? Explain with examples.

1173


What is object in c++ wikipedia?

995


Show the declaration for a pointer to function returning long and taking an integer parameter.

1130


Write a Program for read a line from file from location N1 to N2 using command line arguments. Eg:exe 10 20 a.c

1292


What is the difference between an external iterator and an internal iterator?

1098


Define a pdb file.

1071


Why is c++ still best?

976


If a header file is included twice by mistake in the program, will it give any error?

1044


What is setw manipulator in c++?

1074


What are member functions used in c++?

1143


Explain the difference between using macro and inline functions?

1125