#includestdio.h
#includestddef.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
28.?
int a- 4
Five array of pointer to char 20( each pointer of 4 bytes)
struct node * 4 bytes.
On Tue, Jul 26, 2011 at 6:10 PM, Puneet Gautam puneet.nsi...@gmail.comwrote:
#includestdio.h
#includestddef.h
struct node{
int a;
char *b[5];
struct node *link;
};
4+20+4 = 28 bytes it should be i think
On Tue, Jul 26, 2011 at 6:10 PM, Puneet Gautam puneet.nsi...@gmail.comwrote:
#includestdio.h
#includestddef.h
struct node{
int a;
char *b[5];
struct node *link;
};
main()
{
int a;
a=sizeof(struct node);
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,
@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.comwrote:
why isn't padding done here? We have seen previous posts on size of