@akshata: here padding wont come into picture coz int a =4byte, char *b[5]=4*5byte, *link=4byte all are multiple of 4 . ans will be 28 byte
On Tue, Jul 26, 2011 at 6:42 PM, Akshata Sharma <akshatasharm...@gmail.com>wrote: > why isn't padding done here? We have seen previous posts on size of > structures, where due to padding, the size was not just the sum of size of > datatypes, but also padded bytes. > like here, int (4 bytes), then why is 3 bytes not padded after this, before > char* arr[5] (20 bytes)? > > > On Tue, Jul 26, 2011 at 6:16 PM, sunny agrawal <sunny816.i...@gmail.com>wrote: > >> 4+20+4 = 28 bytes it should be i think >> >> On Tue, Jul 26, 2011 at 6:10 PM, Puneet Gautam >> <puneet.nsi...@gmail.com>wrote: >> >>> #include<stdio.h> >>> #include<stddef.h> >>> struct node{ >>> int a; >>> char *b[5]; >>> struct node *link; >>> }; >>> main() >>> { >>> int a; >>> a=sizeof(struct node); >>> printf("%d",a); >>> getchar(); >>> return 0; >>> } >>> >>> Whats the output..? >>> >>> -- >>> 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. >>> >>> >> >> >> -- >> Sunny Aggrawal >> B-Tech IV year,CSI >> Indian Institute Of Technology,Roorkee >> >> >> -- >> 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. > -- 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.