C Programming help .....wtf ?!?!
Roger Oberholtzer
roger
Wed Jan 26 02:32:38 PST 2005
On Tue, 2005-01-25 at 21:16, Ben Duncan wrote:
> Why does the sizeof( struct _dummymenu) on the below
> return 8 ?
I would expect 5 on a 32-bit processor.
Not sure. What does sizeof(DummyMenu) return? That would have been the
one I would have used. I think it may be that the 'struct _dummymenu' is
part of a typedef statement, and thus may not mean what one may expect.
I would think the only reason to have a _dummymenu part is if you needed
to make a pointer to a DummyMenu inside DummeMenu. So I bet the compiler
treats it a bit odd.
>
>
> typedef struct _dummymenu
> {
> char d_char ;
> int d_sumnumber ;
> } DummyMenu ;
>
> Yet if I do one a structure like this:
>
> typedef struct _dummymenu
> {
> char a_char ;
> char b_char ;
> char c_char ;
> } DummyMenu ;
>
> it returns 3 ......
+????????????????????????????+???????????????????????????????+
? Roger Oberholtzer ? E-mail: roger at opq.se ?
? OPQ Systems AB ? WWW: http://www.opq.se/ ?
? Nybrogatan 66 nb ? Phone: Int + 46 8 314223 ?
? 114 41 Stockholm ? Mobile: Int + 46 733 621657 ?
? Sweden ? Fax: Int + 46 8 314223 ?
+????????????????????????????+???????????????????????????????+
More information about the Linux-users
mailing list