[LCP]struct size

Srinath Thiruvengadam redindian at zxmail.com
Sun Aug 19 04:57:14 UTC 2001


hello all,

please see this code

struct somestruct
{
 int a;
 char b;
 char c;
}stvar;

int main()
{
  printf("%d",sizeof(stvar));
}

the o/p is 8.  i was expecting 6 as 'a' occupies 4 bytest and 'b','c' 
one byte each !  how is it 8 ??

Thanks, 
Srinath
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.linux.org.au/pipermail/linuxcprogramming/attachments/20010819/473e31d5/attachment.htm 


More information about the linuxCprogramming mailing list