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...

what is the size of this class
class size
{
public:
char data1;
double d;
int data2;
char data3;
double data4;
short data5;
};

please explain the padding for these double variables.

Answer Posted / nomesh

double will occupies 8 bytes. so here two double data type
variables create then this class size is 21

char 1 b
double 8 b
int 2 b
char 1 b
double 2 b
short 1 b

Is This Answer Correct ?    2 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How is objective c different from c++?

1301


Which command properly allocates memory a) char *a=new char[20]; b) char a=new char[20]; c) char a=new char(20.0);

1112


Is map thread safe c++?

1129


Explain the difference between abstract class and interface in c++?

1033


What is the difference between set and map in c++?

1176


You want to link a c++ program to c functions. How would you do it?

1037


Difference between a homogeneous and a heterogeneous container

1197


What are abstract data types in c++?

1033


Why is it necessary to use a reference in the argument to the copy constructor?

1175


Why c++ is created?

1048


Is c++ a dying language?

1202


What is the role of copy constructor in copying of thrown objects?

1117


Are there any special rules about inlining?

1125


What is the difference between interpreters and compilers?

1264


What are multiple inheritances (virtual inheritance)?

1107