|
-
February 13th, 2008, 12:34 PM
#1
A question regarding the size of a class.
Say we have a class defined as,
class c
{
char c1;
char c2;
int i1;
int i2;
char *ptr;
static int mem;
};
What is the size of the class c on a 32 bit processor? Here is what I think.
char c1: 1 byte
char c2: 1 byte
int i1: 4 bytes
int i2: 4 bytes
char* ptr: 4 bytes
static int mem: 4 bytes
Totally, 18 bytes. Am I right? Thanks for your inputs.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|