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 / abhishek

absolutely correct navvy agreed !!

just a minor change

short : 2 bytes + 2 byte padding

Is This Answer Correct ?    4 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is c++ vector dynamic?

572


Why do we use structure in c++?

570


What is a hashmap c++?

566


Do you know what are the new features that iso/ansi c++ has added to original c++ specifications?

556


Is recursion allowed in inline functions?

605






Which is better c++ or java?

562


Explain what are mutator methods in c++?

568


How did c++ get its name?

567


Why can templates only be implemented in the header file?

656


What c++ is used for?

577


How to declare an array of pointers to integer?

580


What is the use of endl in c++?

591


What do you mean by volatile and mutable keywords used in c++?

577


What is the difference between object-oriented programming and procedural programming?

689


What is runtime polymorphism in c++?

580