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 / nivvy
This size is 32
Char : 1 + 3 bytes padding
Doube : 8 Bytes
int : 4 bytes
char : 1 + 3 bytes padding
double : 8 bytes
short : 4 bytes
so 32 bits
| Is This Answer Correct ? | 6 Yes | 0 No |
Post New Answer View All Answers
Can java be faster than c++?
Do vectors start at 0?
Is it possible to pass an object of the same class in place of object reference to the copy constructor?
What is a NULL Macro? What is the difference between a NULL Pointer and a NULL Macro?
Eplain extern keyword?
What is capacity in vector in c++?
We all know that a const variable needs to be initialized at the time of declaration. Then how come the program given below runs properly even when we have not initialized p?
How do c++ struct differs from the c++ class?
What is the use of setprecision in c++?
What are 2 ways of exporting a function from a dll?
How to allocate memory dynamically for a reference?
Differentiate between a constructor and a destructor in c++.
How is c++ different from java?
What are the four main data types?
Why is the function main() special?