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 / kanthi
I have a small doubt.. isnt it based upon the underlying
platform on which this piece of code is run?
as far as my c++ knowledge goes, the size of each datatype
varies for each platform unlike java. this is the reason
why java ensures portability of code, while c++ doesnt.
please tell me if i am wrong...
| Is This Answer Correct ? | 4 Yes | 1 No |
Post New Answer View All Answers
What are exceptions c++?
Is map thread safe c++?
What are advantages of using friend classes?
Why #include is used?
what are the iterator and generic algorithms.
Does there exist any way to make the command line arguments available to other functions without passing them as arguments to the function?
What are maps in c++?
Explain the use of this pointer?
What is cin clear () in c++?
When the constructor of a base class calls a virtual function, why doesn't the override function of the derived class gets called?
Is c++ a pure oop language?
What is a container class? What are the types of container classes in c++?
Define linked lists with the help of an example.
How can you say that a template is better than a base class?
Why do we use classes in programming?