procedure TForm1.Button1Click(Sender: TObject);
var
s1:array of byte;
ss:psingle;
a:string;
begin
setlength(s1,4);
s1[0]:=$3e;
s1[1]:=$94;
s1[2]:=$b1;
s1[3]:=$7e;
new(ss);
ss:=@s1[0];
a:=format('%g',[ss^]);
showmessage(a);
showmessage(floattostr(single(s1)));
end;
为什么两次显示结果不同?
var
s1:array of byte;
ss:psingle;
a:string;
begin
setlength(s1,4);
s1[0]:=$3e;
s1[1]:=$94;
s1[2]:=$b1;
s1[3]:=$7e;
new(ss);
ss:=@s1[0];
a:=format('%g',[ss^]);
showmessage(a);
showmessage(floattostr(single(s1)));
end;
为什么两次显示结果不同?
ss:=@s1[1];
如果写成:
showmessage(floattostr(single((@s1[0])^)));
就对了。—————————————————————————————————
宠辱不惊,看庭前花开花落,去留无意;毁誉由人,望天上云卷云舒,聚散任风。
—————————————————————————————————