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;
}
Answers were Sorted based on User's Feedback
1. No difference in size in this case. There will be
difference in size, however, if the class A and B are
defined below:
Class A
{
int a;
double d;
char c;
}
Class B
{
double d;
char c;
int a;
}
| Is This Answer Correct ? | 3 Yes | 0 No |
Answer / 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 |
Write a Program for read a line from file from location N1 to N2 using command line arguments. Eg:exe 10 20 a.c
Write a code/algo to find the frequency of each element in an array?
How are pointers type-cast?
Differentiate between a copy constructor and an overloaded assignment operator.
Write a recursive program to calculate factorial in c++.
What is the difference between a class and a structure in C++?
Why is c++ still best?
What is the best c++ compiler for windows 10?
What is function prototyping?
how to swap two strings without using any third variable ?
What is long in c++?
what is the emaning of '#include" "'?