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
Why are pointers not used in c++?
Explain the difference between abstract class and interface in c++?
Why we use #include conio h in c++?
Can notepad ++ run c++?
What is the main purpose of overloading operators?
What are punctuators in c++?
What is the purpose of extern storage specifier?
Why do you use the namespace feature?
Is c# written in c++?
What does the nocreate and noreplace flag ensure when they are used for opening a file?
What is a c++ vector?
Which operator cannot overload?
what is the difference between overloading & overriding? give example.
What are keywords in c++?
Can union be self referenced?