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 is iostream in c++ used for?
How are virtual functions implemented in c++?
Explain how overloading takes place in c++?
Define vptr.
True or false, if you keep incrementing a variable, it will become negative a) True b) False c) It depends
What is a terminating character in c++?
What are pointers, when declared, intialized to a) NULL b) Newly allocated memory c) Nothing. Its random
What is the role of copy constructor in copying of thrown objects?
What is vector string in c++?
What is a manipulator in c++?
Ask to write virtual base class code?
Must accepts "Maestro Cards" Tax for bike should be less than 15 Total number of lanes is more than 10 Must provides monthly pass Write a method: boolean isGoodTollBridge(String[] cardsAccepted, String[] tollTax, boolean hasMonthlyPass, int numberOfLanes); String[] cardsAccepted A String array of names of card types accepted for payment of toll tax, it can be null if the toll does not accept any card String[] tollTax A String array of toll tax chart (say “Train : 300â€Â,â€ÂBullCart : 10â€Â) boolean hasMonthlyPass This parameter defines whether there is any monthly pass available or not int numberOfLanes This parameter defines the number of lanes for each side
Refer to a name of class or function that is defined within a namespace?
How are the features of c++ different from c?
How would you call C functions from C++ and vice versa?