Hi all.
I'm trying to get the size of a variable in a struct by his relative
postion i.e.
///
#define offsetof(s,m) (size_t)&(((s *)0)->m)
struct ThePimp{
char rings[10];
char blings[20];
};
int sizeOfBling = sizeof( (*char)&ThePimp +
(char)offsetof( ThePimp,blings) );
///
(If I have any syntax mistakes please ignore)
You can easily predict that sizeOfBling will be 4... (sizeof(int*))
Is there any way to acomplish it?
Thanks
I'm trying to get the size of a variable in a struct by his relative
postion i.e.
///
#define offsetof(s,m) (size_t)&(((s *)0)->m)
struct ThePimp{
char rings[10];
char blings[20];
};
int sizeOfBling = sizeof( (*char)&ThePimp +
(char)offsetof( ThePimp,blings) );
///
(If I have any syntax mistakes please ignore)
You can easily predict that sizeOfBling will be 4... (sizeof(int*))
Is there any way to acomplish it?
Thanks
Comment