EmbLogic's Blog

Data Structures With C

In data structure padding some allocate space is free this case is called is padding. Like a example is as as the structure we take three variable that is int,char,float. This is structure allocate 12 byte space. At the architecture of process it read 1 word at the time.(for 32 bit process 4 byte per word and for 64 bit process 8 byte per word).

struct emblogic

{ int; char;float}blog;

 

At this avoid this structure padding in C !

we used

#pragma pack(1)

After that the size of structure this structure is only 9 byte.

My question is where is define this pragma pack(1) (like as include directory  path is /usr/include/ ). And how it works??

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>