EmbLogic's Blog

To Vaibhav Sir: Removed Padding from structure…

Sir,

Problem is solved, got 3rd way to remove the padding from a structure. i.e. Declare a structure like this..

struct abc

{

……..char a;

……..int b;

}__attribute__ ((packed));

main()

{

……. struct abc obj;

………printf(size);

}

Output is : 5

where as in normal 32 bit machine it comes 8 when we directly use a variable.

yups…:-)…C makes me happy

One Response to To Vaibhav Sir: Removed Padding from structure…

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>