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 to connect with oracle 9i with server in socket program in c/c++

2084


What is the use of setprecision in c++?

731


What are separators in c++?

821


What does h mean in maths?

839


What is the difference between an external iterator and an internal iterator? Describe an advantage of an external iterator?

847


Difference between delete and free.

826


Why c++ is the best language?

795


What are the advantages of pointers?

806


Define stacks. Provide an example where they are useful.

776


What is the use of object in c++?

815


What is c++ map?

757


What are c++ templates used for?

869


which operator is used for performing an exponential operation a) > b) ^ c) none

804


What is the full name of logo?

835


What is the use of this pointer in c++?

788