Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How to avoid structure padding in C?

Answer Posted / santosh

Packing, on the other hand prevents compiler from doing padding - this has to be explicitly requested - under GCC it's __attribute__((__packed__)), so the following:

struct __attribute__((__packed__)) mystruct_A {
char a;
int b;
char c;
};

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Which is better between malloc and calloc?

1208


How do you convert strings to numbers in C?

1231


What is an lvalue in c?

1131


What is pivot in c?

1033


What is #line in c?

1020


What is FIFO?

1739


Can you please explain the scope of static variables?

1063


Write the test cases for checking a variable having value in range -10.0 to +10.0?

2322


What are two dimensional arrays alternatively called as?

1191


What is methods in c?

1104


Can you apply link and association interchangeably?

1127


What are the different types of data structures in c?

1167


What is the difference between NULL and NUL?

1304


What is a stream in c programming?

1160


How do I use void main?

1096