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...


What is structure padding & expalain wid example
what is bit wise structure?



What is structure padding & expalain wid example what is bit wise structure?..

Answer / pankaj saraf

Padding is actually a compiler optimization technique, which
fill up the area between to member to make multiples of 4
bytes (32 bits). Only combination chars/ shorts int/ both ca
e able to create a 32 bytes. Compiler actually will skip to
check the size the variable and fetch the whole 4 bytes in
data fetch operation. this will provide the aligned data to
MP in Single CPU cycle.
There is a Pragma directive, which override the compiler and
results the structure size with equal to size of variables.

Example:

Struct item {
int item;
char type;
};

Sizeof (struct item) = 8 bytes

Struct item {
int item;
char type[2];
short int value;
};
Sizeof (struct item) = 8 bytes

Struct item {
int item;
char type[3];
short int value;
};
Sizeof (struct item) = 12 bytes
one byte padded after "type" and 2 byes padded after value.



Bit-Wise: As far as I remember, it maintains a ARRAY of
int/char/bits equal to the number of elements defined inside
. The bit sets if some data is initialized with some value.
I am not sure on this.

Is This Answer Correct ?    4 Yes 1 No

Post New Answer

More C Interview Questions

List out few of the applications that make use of Multilinked Structures?

1 Answers   Accenture,


Explain how can a program be made to print the name of a source file where an error occurs?

0 Answers  


A.C func() { pritnf(" in fuction %d",MACRO); } MAIN.c testfunc() { #define MACRO 10 printf("in test function %d", MACRO); } main() { printf("in main %d",MACRO); func(); testfunc(); getch(); }

2 Answers   Wipro,


How can I remove the leading spaces from a string?

0 Answers  


What does double pointer mean in c?

0 Answers  


Hai what is the different types of versions and their differences

0 Answers  


How can I do serial ("comm") port I/O?

0 Answers   Celstream,


can we declare a function in side the structure?

2 Answers   HCL,


What is void main ()?

0 Answers  


1)which of following operator can't be overloaded. a)== b)++ c)?! d)<=

16 Answers   CybOrg, Siemens,


What is d scanf?

0 Answers  


how to make program without <> in libray.

0 Answers  


Categories