在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
program Day4; {$APPTYPE CONSOLE} uses SysUtils, Util in 'Util.pas'; type TPerson = packed record ID : integer; case IsFullJob : Boolean of true: ( Year : Cardinal; ); false:( Hour : word; ); end; var s : string; ss : ShortString; p : TPerson; begin Writeln('sizeof integer:',sizeof(integer)); Writeln('sizeof cardinal:',sizeof(cardinal)); Writeln('sizeof word:',sizeof(word)); Writeln('sizeof boolean:',sizeof(boolean)); Writeln('sizeof TPERSON:',sizeof(Tperson)); p.ID := 110; p.Year := $80000001; //$8 = 1000 b Writeln('p.year:',p.year); Writeln('p.hour:',p.hour); p.IsFullJob := true; Writeln('p.IsFullJob:',p.IsFullJob); readln; end. 类似C中的联合体union. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论