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 a pragma?

1123


given post order,in order construct the corresponding binary tree

2779


Explain Basic concepts of C language?

1150


What is 'bus error'?

1144


how to solve "unable to open stdio.h and conio.h header files in windows 7 by using Dos-box software

3314


What do you understand by normalization of pointers?

1058


What is a lookup table in c?

1117


What is the advantage of an array over individual variables?

1229


Explain the concept and use of type void.

1112


What is the auto keyword good for?

1144


What is local and global variable in c?

1196


Write a program to know whether the input number is an armstrong number.

1113


What is a loop?

1034


What are qualifiers?

1045


What do mean by network ?

1160