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
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
Comment