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

FILE PROGRAMMING

2178


Explain output of printf("Hello World"-'A'+'B'); ?

1430


What is void pointers in c?

957


What are derived data types in c?

1007


What is the difference between typedef struct and struct?

1065


Not all reserved words are written in lowercase. TRUE or FALSE?

1180


Why pointers are used?

1022


What are file streams?

964


Explain the difference between structs and unions in c?

958


Can a pointer point to null?

1021


How can I call fortran?

991


What is the purpose of main() function?

1183


What are variables c?

997


Write a program to input the price of 1 burger and the number of burgers eaten by a group of friends .print the total amount to be paid by the group?

984


Why do we use static in c?

1065