@harry Structure padding is done by the compilers and this depends on the architectures. Some architectures cannot access the data which will be stored on the odd addresses or they may find difficult to access it. This is the reason for padding extra bytes.
Padding will be done by compiler to structure’s members and to the structure as a whole also. Compiler pads structure as whole because this allows each member of structure aligned in array of structures Structure padding example Struct EX { Char a; int b; Short int c; }; Due to structure padding this structure size is going to be (a[1 byte + padding 3 byte + b[4 byte] + c[2 byte] + 2 byte padding = 12byte ) instead of 7 byte. *Subhransu Panigrahi * *Email:* subhransu.panigr...@gmail.com On Sun, Mar 27, 2011 at 10:54 PM, hary rathor <harry.rat...@gmail.com>wrote: > hello geeks: > > can any body tell me how structure padding work? > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.