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.
