What is the difference in size of this two clasees?
Class A
{
int a;
char c;
float f;
}
Class B
{
float f;
char c;
int a;
}

Answer Posted / som shekhar

well there will be no difference..define the macro
#pragma pack(1) and then calculate the size of the class....

Actually compiler aligns the boundary to the nearest larger
byte. If you define the aforementioned macro, compiler will
give you the exact size of the class.

Hope that is clear.

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is java a c++?

558


What is private inheritance?

592


Will c++ be replaced?

544


What is the header file for setw?

573


What is data type in c++?

553






What is the role of C++ shorthand's?

672


How a modifier is similar to mutator?

630


I want explanation for this assignment: how to connect mysql database using c/c++,please explain this detailly?

1579


What is private, public and protected inheritance?

585


What does new do in c++?

631


Define upcasting.

588


Can c++ be faster than c?

597


How did c++ start?

606


Can member data be public?

595


What is c++ runtime?

651