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 / lakshman naganoor

By #pragma

Example:
#pragma pack(push,1)
struct mystruct_A {
int b;
short d;
double c;
char m;
};
#pragma pack(pop)

main()

{
printf("size of structure mystruct_Ad is %d\n",sizeof
(struct mystruct_A));
}

size of structure mystruct_Ad is 15

Note:size of structure mystruct_Ad without using #pragma

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the purpose of 'register' keyword?

1103


Why functions are used in c?

1144


What does stand for?

1093


what value is returned to operating system after program execution?

2128


How can I change their mode to binary?

1127


What is equivalent to ++i+++j?

1097


What is a void pointer? When is a void pointer used?

1065


What is structure pointer in c?

1067


What is the value of c?

1070


How can you find out how much memory is available?

1073


Explain what header files do I need in order to define the standard library functions I use?

1175


What is a far pointer in c?

1049


Explain 'bit masking'?

1094


Explain how do I determine whether a character is numeric, alphabetic, and so on?

1141


Can you assign a different address to an array tag?

1177