16,747
社区成员




var
str1 ,str2: string;
procedure TForm1.Button1Click(Sender: TObject);
begin
str1 := 'abcd';
str2 := str1;
Memo1.Lines.Add(IntToStr(Integer(@str1[1]))) ; //注释掉这句和添加这句对结果影响很大。
Memo1.Lines.Add(IntToStr(Integer(str1))) ;
Memo1.Lines.Add(
'str1 Address: ' + IntToStr(Integer(str1)) + #13#10 +
'str1 Reference: ' + IntToStr(PInteger(Integer(str1) - 8)^) + #13#10 +
'str1 Value: ' + str1 + #13#10 +
'str2 Address: ' + IntToStr(Integer(str2)) + #13#10 +
'str2 Reference: ' + IntToStr(PInteger(Integer(str2) - 8)^) + #13#10 +
'str2 Value: ' + str2 + #13#10
);
str2 := '1234';
Memo1.Lines.Add('str2 := ''1234''');
Memo1.Lines.Add(
'str1 Address: ' + IntToStr(Integer(str1)) + #13#10 +
'str1 Reference: ' + IntToStr(PInteger(Integer(str1) - 8)^) + #13#10 +
'str1 Value: ' + str1 + #13#10 +
'str2 Address: ' + IntToStr(Integer(str2)) + #13#10 +
'str2 Reference: ' + IntToStr(PInteger(Integer(str2) - 8)^) + #13#10 +
'str2 Value: ' + str2 + #13#10
);
end;