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
Is map thread safe c++?
What is c++ and its uses?
What is a storage class?
Describe private, protected and public – the differences and give examples.
. If employee B is the boss of A and C is the boss of B and D is the boss of C and E is the boss of D. Then write a program using the Database such that if an employee name is Asked to Display it also display his bosses with his name. For eg. If C is displayed it should also display D and E with C?
Explain what are the sizes and ranges of the basic c++ data types?
What is a constructor in c++ with example?
Which should be more useful: the protected and public virtuals?
What are mutator methods in c++?
What it is and how it might be called (2 methods).
What are all predefined data types in c++?
Why should we use null or zero in a program?
What is math h in c++?
Explain Text Manipulation Routines?
What is boyce codd normal form in c++?