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
What is implicit conversion/coercion in c++?
What flag means?
What is a stack c++?
What is the c++ programming language used for?
Which compiler does turbo c++ use?
What is a type library?
Is eclipse good for c++?
What is a hashmap c++?
What is a Default constructor?
Can manipulators fall in love?
I want to write a C++ language program that: 1. Reads in the size of a square from the screen; 2. Prints a hollow square of that size out of “-“, “|” and blanks on screen; 3. Prints the same hollow square onto a text file. The program should work for squares of all side sizes between 1 and 20.
Explain public, protected, private in c++?
Explain terminate() and unexpected() function?
What is object oriented programming (oop)?
If we want that any wildcard characters in the command line arguments should be appropriately expanded, are we required to make any special provision? If yes, which?