adspace


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

daily Routine of father

1489


Can union be self referenced?

1275


How c functions prevents rework and therefore saves the programers time as wel as length of the code ?

1172


What character terminates all character array strings a) b) . c) END

1403


What is the latest version on c++?

1217