#include <stdio.h> struct verify { char initials[2]; int birthdate; }; int main(void) { struct verify holes; printf ("%d\n", sizeof(holes.initials[0])); printf ("%d\n", sizeof(holes.initials)); printf ("%d\n", sizeof(holes.birthdate)); printf ("%d\n", sizeof(holes)); return 0; } Given that the word-byte In 16-bit computer = 2 bytes word the output is, 1 2 2 4 in 32-bit computer = 4 bytes word the output is, 1 2 4 8
k, I am a newb, so someone plz quickly explain to me why the variable 'initial'
takes 2 bytes, 'birthdate' takes 4 bytes but the struct which is 2+4 = 6 bytes takes 8 bytes? -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html