Thursday, 8 August 2013

sizeof for a structure with char c[0]

sizeof for a structure with char c[0]

Struct xyz {
int a;
int b;
char c[0];
};
struct xyz x1;
printf("Size of structure is %d",sizeof(x1));
Output: 8 why isn't the size of structure 9 bytes? Is it because the
character array declared is of size 0?

No comments:

Post a Comment