Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.csd.uwm.edu!bionet!ames!pacbell!pbhya!afh From: afh@PacBell.COM (Alan Hobesh) Newsgroups: comp.lang.c Subject: sizeof struct Keywords: sizeof struct Message-ID: <29722@pbhya.PacBell.COM> Date: 5 Sep 89 22:27:37 GMT Distribution: na Organization: Pacific * Bell, San Ramon, CA Lines: 32 The following c code prints the size of the definded structure to be 44, when compiled on an AT&T 3B20 running UNIX V5.2.1. /*------------------------------------------------------------*/ #include struct REC { char vis_date[6]; char vis_time[6]; char vis_port[2]; char vis_rec_type[2]; char vis_seq_num[5]; char vis_phone_num[10]; char vis_switch[4]; char vis_stop_dur[6]; char vis_cr; } recbuf; main() { printf("struct = %d\n",sizeof(struct REC)); } /*------------------------------------------------------------*/ However, when the code is downloaded to a PC and compiled using Turbo C, the size of the structure is reported to be 42. Why is there a difference and which is the correct size?