Re: querry related to structure padding
- From: "Robert Gamble" <rgamble99@xxxxxxxxx>
- Date: 18 Mar 2006 20:00:34 -0800
Lalatendu Das wrote:
hi let's say i have a structure
struct test {
int A;
char B[5];
int C;
};
this above structure defination always going to take 16 byte in
memeory in whatever manner we align the member variables while
declaring a variable to it .
because variable 'A' going to take 4 byte then four charachter of
array gonna take another 4 bytes but the remaining will take also 4
bytes due to four byte alignment nature of compiler .
and last four byte by integer C .
what i want is there any way i can start storing integer C just after
the storing completion of array B's last element i.e. B[4] , so that i
can suppress padding . Any program which make memory manager store in
the above manner is most welcome.
thanks priorly because i am sure i am gonna get innumerable answer to
it .
No, not portably. See: http://www.c-faq.com/struct/padding.html
Robert Gamble
.
- References:
- querry related to structure padding
- From: Lalatendu Das
- querry related to structure padding
- Prev by Date: Re: different outputs in gcc and tc
- Next by Date: Re: querry related to structure padding
- Previous by thread: querry related to structure padding
- Next by thread: Re: querry related to structure padding
- Index(es):
Relevant Pages
|