i thnk it should be 4 for int 1 for char 4 for float 3 padding to make multiple of 4..i read it from
http://forums.techarena.in/software-development/1241260.htm correct me if am wrong On Sun, Sep 4, 2011 at 1:54 AM, Karthikeyan palani <[email protected] > wrote: > in 32 bit m/c > > 4 for int > 1 for char + 3 padding > 4 for float > so, totally it takes 12 bytes.. > > On 03/09/2011, rahul sharma <[email protected]> wrote: > > ans is: 16 i thninkj....... > > float take 8 bytes > > > > so pdding is :- > > > > int take 4 bytes > > 1 char > > 3 bytes pad > > + 8 byte float=16 > > > > > > On Sat, Sep 3, 2011 at 10:30 PM, siddharam suresh > > <[email protected]>wrote: > > > >> each object in the structure will take one memory word.(if one object > then > >> its size of that object) > >> Thank you, > >> Sid. > >> > >> > >> > >> On Sat, Sep 3, 2011 at 10:27 PM, Debabrata Das < > >> [email protected]> wrote: > >> > >>> how output is 12 on typical 32 bit system and why? > >>> #include<stdio.h> > >>> struct x > >>> { > >>> int y; > >>> char x; > >>> float z; > >>> }; > >>> main() > >>> { > >>> printf("%d",sizeof(struct x)); > >>> } > >>> > >>> what is the rule of padding.... > >>> > >>> -- > >>> You received this message because you are subscribed to the Google > Groups > >>> "Algorithm Geeks" group. > >>> To post to this group, send email to [email protected]. > >>> To unsubscribe from this group, send email to > >>> [email protected]. > >>> 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 [email protected]. > >> To unsubscribe from this group, send email to > >> [email protected]. > >> 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 [email protected]. > > To unsubscribe from this group, send email to > > [email protected]. > > For more options, visit this group at > > http://groups.google.com/group/algogeeks?hl=en. > > > > > > > -- > karthikeyankkn > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > > -- *Dheeraj Sharma* Comp Engg. NIT Kurukshetra +91 8950264227 -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
