struct padding ???
- From: vikas talwar <vikas.talwar@xxxxxxxxx>
- Date: Sat, 31 May 2008 08:39:16 -0700 (PDT)
Hi All,
Can you please explain me how the 'C' compiler allocate memory to
'struct'.
Please go thu the example below and pls suggest me the solution for my
problem.
Here is my structure definition
struct my_dev {
char abc;
} ;
and now when I do
printf("size=%d\n", sizeof(struct my_dev));
output is: 4
But I expect the size of struct = '1'.
Is there any trick to get the struct to occupy memory with pad of 1
byte and not 4 bytes..
--
Thanks
Vikas
.
- Follow-Ups:
- Re: struct padding ???
- From: Jens Thoms Toerring
- Re: struct padding ???
- Prev by Date: Re: private functions
- Next by Date: Re: strtok question
- Previous by thread: private functions
- Next by thread: Re: struct padding ???
- Index(es):
Relevant Pages
|