Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C > sizeof a relati...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 20 Topic 25026 of 27343
Post > Topic >>

sizeof a relative pointer in a struct

by ManicQin <ManicQin@[EMAIL PROTECTED] > Mar 20, 2008 at 08:39 AM

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
 




 20 Posts in Topic:
sizeof a relative pointer in a struct
ManicQin <ManicQin@[EM  2008-03-20 08:39:47 
Re: sizeof a relative pointer in a struct
Noob <root@[EMAIL PROT  2008-03-20 16:52:44 
Re: sizeof a relative pointer in a struct
REH <spamjunk@[EMAIL P  2008-03-20 09:41:57 
Re: sizeof a relative pointer in a struct
Keith Thompson <kst-u@  2008-03-20 09:44:44 
Re: sizeof a relative pointer in a struct
rpgfan3233 <rpgfan3233  2008-03-20 09:46:38 
Re: sizeof a relative pointer in a struct
Martin Ambuhl <mambuhl  2008-03-20 15:02:49 
Re: sizeof a relative pointer in a struct
REH <spamjunk@[EMAIL P  2008-03-20 13:57:34 
Re: sizeof a relative pointer in a struct
ManicQin <ManicQin@[EM  2008-03-21 06:23:58 
Re: sizeof a relative pointer in a struct
Keith Thompson <kst-u@  2008-03-21 09:34:43 
Re: sizeof a relative pointer in a struct
REH <spamjunk@[EMAIL P  2008-03-22 09:08:27 
Re: sizeof a relative pointer in a struct
REH <spamjunk@[EMAIL P  2008-03-22 09:12:21 
Re: sizeof a relative pointer in a struct
ManicQin <ManicQin@[EM  2008-03-23 02:05:16 
Re: sizeof a relative pointer in a struct
Ben Bacarisse <ben.use  2008-03-23 13:58:19 
Re: sizeof a relative pointer in a struct
ManicQin <ManicQin@[EM  2008-03-23 23:41:06 
Re: sizeof a relative pointer in a struct
Ben Bacarisse <ben.use  2008-03-24 12:25:56 
Re: sizeof a relative pointer in a struct
ManicQin <ManicQin@[EM  2008-03-24 05:44:01 
Re: sizeof a relative pointer in a struct
Richard Heathfield <rj  2008-03-24 13:06:23 
Re: sizeof a relative pointer in a struct
Ben Bacarisse <ben.use  2008-03-24 16:22:14 
Re: sizeof a relative pointer in a struct
ManicQin <ManicQin@[EM  2008-03-24 12:57:44 
Re: sizeof a relative pointer in a struct
pete <pfiland@[EMAIL P  2008-03-28 22:31:58 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Sep 6 21:50:11 CDT 2008.