whats the size of class EXP on 32 bit processor?
class EXP
{
char c1;
char c2;
int i1;
int i2;
char *ptr;
static int mem;
};
Answer Posted / ricardo
The answer is 16 (on most compilers), but not for the
reasons stated above.
If the class contained only c1 and c2, the size would be
2. Since i1 is an integer, though, it needs to be aligned
on a 4-byte multiple. The pointer and the other integer
also uses up 4 bytes. So, the total size is 16.
If there were another character field "c3" adjacent to c2,
the size would still be 16 bytes.
| Is This Answer Correct ? | 4 Yes | 0 No |
Post New Answer View All Answers
How do you master coding?
Why is "using namespace std;" considered bad practice?
Write about the various sections of the executable image?
can any one help to find a specific string between html tags
which is changed to a sting..
weather.html looks (for location) is
What are protected members in c++? What new()is different from malloc()? Differentiate between late binding and early binding. What is setfill c++? What is the use of default constructor? Am pass the 10000 records to target in target I will take commit interval 15000 when I was stop the work flow what will happened Name four predefined macros. How does list r; differs from list r();? If you push the numbers (in order) 1, 3, and 5 onto a stack, which pops out first
a) 1
b) 5
c) 3 What is the use of main function in c++? What is the difference between structure and class?