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 / ada
I tried sizeof() the class and the output is 40 bytes. I
think the padding maybe like this:
char data1 1+7 bytes
double d 8 bytes
int data2 4 bytes char data3 1+3 bytes
double data4 8 bytes
short data5 2+6 bytes
So totally 5x8=40 bytes
| Is This Answer Correct ? | 3 Yes | 1 No |
Post New Answer View All Answers
Why Pointers are not used in C++?
Write about the scope resolution operator?
How do you declare A pointer to a function which receives nothing and returns nothing
What do you understand by a pure virtual member function?
Define pure virtual function?
What is a class template in c++?
Search for: what is pair in c++?
the first character in the variable name must be an a) special symbol b) number c) alphabet
What is pointer with example?
how to access grid view row?
Eplain extern keyword?
What is token c++?
Who calls main function?
What is a class definition?
What is a flag in c++?